Skip to content

Instantly share code, notes, and snippets.

Avatar

Jennifer (Jenny) Bryan jennybc

View GitHub Profile
@jennybc
jennybc / miles.md
Last active Feb 25, 2021
A rowwise summary problem where we don't want to use `rowwise()`
View miles.md
library(tidyverse)

(df <- tibble(
  id = 1:3,
  wut = letters[3:1],
  x1 = 1:3,
  x2 = 4:6,
  x3 = 7:9
))
@jennybc
jennybc / locale-demo-output.md
Last active Feb 14, 2021
Localization demo
View locale-demo-output.md

I execute:

reprex({
  # inheriting everything from local system
  # for Jenny, this means English
  "a" / 2
  1:3 == c(1:2, 5)
  format(as.Date(c("2019-01-01", "2019-02-01")), "%d %B %Y")
})
View portalr-usethis-revdepcheck.md

══ Reverse dependency check ══════════════════════════════════════ portalr 0.3.6 ══

Status: BROKEN

── Newly failing

x checking tests ... ERROR

── Before ───────────────────────────────────────────────────────────────────────── 0 errors ✓ | 0 warnings ✓ | 0 notes ✓

@jennybc
jennybc / 2020-03-29_sane-legend.R
Created Mar 30, 2020
Make the legend order = data order, with forcats::fct_reorder2()
View 2020-03-29_sane-legend.R
library(tidyverse)
library(patchwork)
dat_wide <- tibble(
x = 1:3,
top = c(4.5, 4, 5.5),
middle = c(4, 4.75, 5),
bottom = c(3.5, 3.75, 4.5)
)
View TIOBE redux
Exerting my will over the gist name
@jennybc
jennybc / vv_transformer.R
Last active Aug 9, 2019
A glue transformer inspired by the "variables & values" f-string syntax in Python 3.8
View vv_transformer.R
library(glue)
vv_transformer <- function(text, envir) {
regex <- "=$"
if (!grepl(regex, text)) {
return(identity_transformer(text, envir))
}
text <- sub(regex, "", text)
res <- identity_transformer(text, envir)
n <- length(res)
@jennybc
jennybc / get-function-signatures_reprex.R
Last active Dec 26, 2019
List all function signatures in a package
View get-function-signatures_reprex.R
library(tidyverse)
## attach the package whose function signatures you want to examine
pkg <- "usethis"
library(pkg, character.only = TRUE)
x <- lsf.str(pos = paste0("package:", pkg))
## inspired by examining print.ls_str and head.function
get_signatures <- function(x) {
x %>%
View curl commands
curl 'https://sheets.googleapis.com/v4/spreadsheets/1eP_0mb67k0MD9BBEZ5gv7jsyFzcTvMbrr3uGTG1GXZk?includeGridData=true&ranges=Sheet1!A1%3AG6&key=AIzaSyDXicV6oK4vR948PUAvlyr7QhkNwCoQ0cA' -H 'Accept: application/json' --compressed > spreadsheets_get_3.json
curl 'https://sheets.googleapis.com/v4/spreadsheets/1eP_0mb67k0MD9BBEZ5gv7jsyFzcTvMbrr3uGTG1GXZk/values/Sheet1!A1%3AG6?key=AIzaSyDXicV6oK4vR948PUAvlyr7QhkNwCoQ0cA' -H 'Accept: application/json' --compressed > spreadsheets_values_get_3.json
View curl commands
curl 'https://sheets.googleapis.com/v4/spreadsheets/132Ij_8ggTKVLnLqCOM3ima6mV9F8rmY7HEcR-5hjWoQ?includeGridData=true&ranges=Sheet1!A1%3AF6&key=AIzaSyDXicV6oK4vR948PUAvlyr7QhkNwCoQ0cA' -H 'Accept: application/json' --compressed > spreadsheets_get_2.json
curl 'https://sheets.googleapis.com/v4/spreadsheets/132Ij_8ggTKVLnLqCOM3ima6mV9F8rmY7HEcR-5hjWoQ/values/Sheet1!A1%3AF6?key=AIzaSyDXicV6oK4vR948PUAvlyr7QhkNwCoQ0cA' -H 'Accept: application/json' --compressed > spreadsheets_values_get.json
View curl commands
curl 'https://sheets.googleapis.com/v4/spreadsheets/1BzfL0kZUz1TsI5zxJF1WNF01IxvC67FbOJUiiGMZ_mQ?includeGridData=true&ranges=Africa!A1%3AF3&key=AIzaSyDXicV6oK4vR948PUAvlyr7QhkNwCoQ0cA' -H 'Accept: application/json' --compressed > spreadsheets_get.json
curl 'https://sheets.googleapis.com/v4/spreadsheets/1BzfL0kZUz1TsI5zxJF1WNF01IxvC67FbOJUiiGMZ_mQ/values/Africa!A1%3AF3?key=AIzaSyDXicV6oK4vR948PUAvlyr7QhkNwCoQ0cA' -H 'Accept: application/json' --compressed > spreadsheets_values_get.json