R Cheatsheets Search Table

interactive table of cheatsheet tags and links

Photo by on

Quick post: I’ve had challenges finding the right R cheatsheet at the right time. Here is the official , where you can subscribe to cheatsheet updates. Thought it would be useful to have a quick search table to lookup cheatsheets from the RStudio . The PDFs are helpful to get a refresher on a package or learn more about a package.

Used httr package with Github’s API (based on Stackoverflow post) to get a list of relevant files in the repo. Did some data wrangling to get language, PDF download and preview hyperlinks. Then manually added a column with PDF titles (to the CSV file) to enable easier searching, since oftentimes the file name does not match cheatsheet title. Link to original blog post with table below.

Interactive Table

Source Code

DT::({
# https://stackoverflow.com/questions/25485216/how-to-get-list-files-from-a-github-repository-folder-using-r
()
()
()
#note that there is a default public rate limit; authenticated users get higher rate limit
#didnt set that up here
(
expr = {
csheet_data <- readr::("https://raw.githubusercontent.com/parmsam/R-cheatsheets-explorer/main/csheet_data.csv")
},
error = {
req <- ("https://api.github.com/repos/rstudio/cheatsheets/git/trees/master?recursive=1")
(req)
filelist <- (((req)$tree, "[", "path"), use.names = F)

cheatsheet_list <- filelist[filelist %>% ("pdf")]

base_url <- "https://github.com/rstudio/cheatsheets/raw/master/"

base_gh_url <-"https://github.com/rstudio/cheatsheets/blob/master/"

csheet_data <- cheatsheet_list %>%
() %>%
(`PDF Links` = value)

# readr::write_csv(csheet_data, "csheet_data.csv")
})

csheet_data2 <- csheet_data %>%
(Tags = cheatsheet_list) %>%
(Tags = (Tags, "/",", ")) %>%
(Tags = (Tags, "([a-z])([A-Z])","\\1 \\2")) %>%
(Tags = (Tags, "[-_]"," ")) %>%
(Tags = (Tags, "\\.pdf")) %>%
(`PDF Links` = (base_url, cheatsheet_list)) %>%
(`Github Links` = (base_gh_url, cheatsheet_list)) %>%
# mutate(`Embedded` = str_c('<iframe src=', `Github Links`, '></iframe>')) %>%
(`Github Links` = ("<a href='", `Github Links`, "'>Preview here</a>")) %>%
(`PDF Links` = ("<a href='", `PDF Links`, "'>Download here</a>"))

csheet_data3 <- csheet_data2 %>% (Language = (Tags, "translations, .*,") ) %>%
(Language = (Language, "translations, ")) %>%
(Language = (Language, "|(, [a-zA-Z ,]*)")) %>%
(Language = ((Language), "english", (Language, ",") )) %>%
(Tags, Language, `PDF Title`)

csheet_data3},
escape = FALSE)

Data Analyst & Computer Science Student. Opinions are my own.