library(tidyverse)
library(widyr)
library(maps)
#>
#> Attaching package: 'maps'
#> The following object is masked from 'package:purrr':
#>
#> map
eurovision_votes <- read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-05-17/eurovision-votes.csv')
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Current limitation is that the images that are used are relative to the | |
# package lib.loc / help so what might be idea lis to extract the image | |
# and base64 encode them using {b64} | |
pkg_to_quarto_doc <- function(pkg, out_path = paste0(pkg, ".qmd"), ...) { | |
tmp <- tempfile() | |
base_doc <- tools::pkg2HTML(pkg, out = tmp, ...) | |
# read in html | |
og <- rvest::read_html(tmp) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ============================== Format ============================== | |
# :emoji: Subject | |
# | |
# Commit body... | |
# | |
# ============================== Emojis ============================== | |
# 🎉 :tada: Initial commit | |
# ✨ :sparkles: Introduce new feature | |
# ⚡️ :zap: Inprove performance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# if (FALSE && rlang::is_interactive()) { | |
if (interactive() && !"rlang" %in% rownames(utils::installed.packages())) utils::install.packages("rlang", type = "binary") | |
# options(rlang_interactive = FALSE) | |
if (interactive()) rlang::check_installed(c("pak", "rprojroot", "tidyverse", "gt", "quarto", "skimr", "kit", "sf")) | |
# my packages | |
# if (interactive()) { | |
# invisible(pak::repo_add(sfirke = "https://sfirke.r-universe.dev", olivroy = "https://olivroy.r-universe.dev")) | |
# } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bowling_animation_urls <- c( | |
"0.01" = "https://i.imgur.com/Kn8CQbj.gif", | |
"0.05" = "https://i.imgur.com/HFTKdDL.gif", | |
"0.1" = "https://i.imgur.com/8Sw54Mz.gif", | |
"1" = "https://i.imgur.com/kjROdhj.gif" | |
) | |
# We need to download the animations to the session temp dirercorty to display | |
# them in the Rstudio Viever pane | |
bowling_animation_html <- sapply(bowling_animation_urls, function(url) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Render Table of Contents | |
#' | |
#' A simple function to extract headers from an RMarkdown or Markdown document | |
#' and build a table of contents. Returns a markdown list with links to the | |
#' headers using | |
#' [pandoc header identifiers](http://pandoc.org/MANUAL.html#header-identifiers). | |
#' | |
#' WARNING: This function only works with hash-tag headers. | |
#' | |
#' Because this function returns only the markdown list, the header for the |