Skip to content

Instantly share code, notes, and snippets.

View gadenbuie's full-sized avatar
💭
sending beep-boops back to the Snarfus

Garrick Aden-Buie gadenbuie

💭
sending beep-boops back to the Snarfus
View GitHub Profile
version_diff <- function(old, new) {
stopifnot(length(old) == length(new))
if (length(old) > 1) {
has_names <- !is.null(names(old))
return(
mapply(version_diff, old, new, SIMPLIFY = FALSE, USE.NAMES = has_names)
)
}

Tidyverse all the way and read in the data from the gist

library(tidyverse)

gist_csv <- "https://gist.github.com/dgkeyes/e37a1aefba31578c29e1418b6f897a68/raw/9e15eec3e4d5f0c138f088510e5808ec68ef8320/all_content.csv"

x <- read_csv(gist_csv)
@gadenbuie
gadenbuie / user-prefs.json
Last active March 7, 2022 19:13
{rsprefs} RStudio Preferences Sync
{
"sync": {
"check_arguments_to_r_function_calls": true,
"check_unexpected_assignment_in_function_call": true,
"console_double_click_select": true,
"continue_comments_on_newline": true,
"document_author": "Luke Skywalker",
"editor_keybindings": "vim",
"font_size_points": 12,
"highlight_r_function_calls": true,
library(httr2)
# setup and perform the request for a file
req <- request("https://placekitten.com/200/300") %>%
req_perform()
# The response body contains raw data,
# so we read that into a vector (into memory so can't be super big)
resp_binary <- resp %>% resp_body_raw()
library(tidyverse)
r_ver <- jsonlite::read_json("https://rversions.r-pkg.org/r-versions")
r_ver %>%
map_dfr(~ .) %>%
separate(version, c("major", "minor", "patch"), "[.]") %>%
mutate(
version = paste(major, minor, patch, sep = '.'),
date = lubridate::ymd_hms(date),
date = lubridate::as_date(date)
@gadenbuie
gadenbuie / Count Code lines
Created September 10, 2021 14:31 — forked from amitchhajer/Count Code lines
Count number of code lines in git repository per user
git ls-files -z | xargs -0n1 git blame -w | perl -n -e '/^.*\((.*?)\s*[\d]{4}/; print $1,"\n"' | sort -f | uniq -c | sort -n

Keybase proof

I hereby claim:

  • I am gadenbuie on github.
  • I am grrrck (https://keybase.io/grrrck) on keybase.
  • I have a public key ASArjlnyx3yFbrIOKRtDNRtR5WGjOuV9OMXIA4kD-8NXZwo

To claim this, I am signing this object:

@gadenbuie
gadenbuie / find_all_errors.R
Created July 17, 2021 19:30 — forked from JBGruber/find_all_errors.R
Find error messages of all installed packages
# get all packages
pkgs <- installed.packages()[, 1]
# make progress bar
pb <- progress::progress_bar$new(total = length(pkgs))
fcts <- purrr::map_df(pkgs, function(x) {
pb$tick()
@gadenbuie
gadenbuie / xaringan-alt-text-background-image.Rmd
Last active May 28, 2021 21:27
make background images on slides accessible with alt text
---
title: "Accessible Background Image Demo"
output:
xaringan::moon_reader:
lib_dir: libs
css: [robot, robot-fonts]
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
library(tidycensus)
library(ggiraph)
library(tidyverse)
library(patchwork)
vt_income <- get_acs(
geography = "county",
variables = "B19013_001",
state = "VT",
year = 2019,