https://twitter.com/jgeller_phd/status/1616939690132738055
Messages are turned on.
message("hello")| --- | |
| title: Reading a YAML chunk | |
| output: github_document | |
| --- | |
| Here's a simple YAML chunk (with the label `config`): | |
| ```{yaml config} | |
| default: | |
| user: "garrick" |
| #!/usr/bin/env -S Rscript --vanilla | |
| rlang::check_installed(c("docopt", "pkgdown", "servr", "fs", "pkgload")) | |
| 'usage: | |
| pkgdown-watch [--port=<port> --rebuild --no-sound] | |
| pkgdown-watch -h | --help | |
| options: | |
| --port=<port> Port to use for the server [default: 4323] |
https://twitter.com/jgeller_phd/status/1616939690132738055
Messages are turned on.
message("hello")| snps <- | |
| list(r = "~/.config/rstudio/snippets/r.snippets") %>% | |
| purrr::map(readLines, warn = FALSE) %>% | |
| purrr::map(paste, collapse = "\n") %>% | |
| purrr::map(trimws) %>% | |
| purrr::map(strsplit, split = "(^|\n)snippet ") %>% | |
| purrr::map_depth(2, ~ .x[.x != ""]) %>% | |
| purrr::map_depth(2, ~ { | |
| nm <- gsub("^([^\n\t ]+).*", "\\1", .x) | |
| names(.x) <- nm |
| library(tidyverse) | |
| checks <- cchecks::cch_pkgs_history(x = "xaringanthemer", limit = 50) | |
| checks$data$history |> | |
| unnest(checks) |> | |
| filter(status != "OK") |> | |
| mutate(across(date_updated, lubridate::ymd_hms)) |> | |
| arrange(date_updated) |> | |
| mutate( |
| library(tidyverse) | |
| library(lubridate) | |
| # https://data.cityofchicago.org/Public-Safety/Crimes-2015/vwwp-7yr9 | |
| crimes <- read_csv("crimes.csv", lazy = TRUE, show_col_types = FALSE) | |
| crimes |> | |
| slice_sample(n = 500) |> | |
| mutate( | |
| Date = mdy_hms(Date), |
| # These functions were borrowed from klmr/box | |
| # https://github.com/klmr/box/tree/5e411d47/scripts | |
| #+ | |
| verify_function_has_value = function (file) { | |
| rd = tools::parse_Rd(file) | |
| type = find_tag(rd, 'docType') | |
| (length(type) != 0L && type != 'function') || length(find_tag(rd, 'value')) != 0L | |
| } |
| library(dplyr) | |
| library(dbplyr) | |
| library(starwarsdb) | |
| con <- starwars_connect() | |
| tbl(con, sql("select * from films")) | |
| #> # Source: SQL [?? x 6] | |
| #> # Database: duckdb_connection | |
| #> title episode_id opening_crawl director producer release_date |
| gist_to_carbon <- function( | |
| gist_id, | |
| file = "code.png", | |
| bg = "#4A90E2", | |
| bg_alpha = 1, | |
| theme = "shades-of-purple", | |
| font = "Fira+Code", | |
| lang = "auto", | |
| drop_shadow = TRUE, | |
| width = 680, |
| library(dplyr) | |
| library(tidyr) | |
| library(purrr) | |
| r_versions <- jsonlite::read_json("https://rversions.r-pkg.org/r-versions") | |
| add_r_4_2 <- function(x) { | |
| has_r_4_2 <- x %>% | |
| filter(major == 4, minor == 2) %>% | |
| nrow() %>% |