Chomp <- R6::R6Class(
"chomp",
public = list(
string = "",
current = "",
result = list(),
initialize = function(string) {
self$string <- string
self$current <- string
View js-ternary-in-r.R
`?` <- function(condition, result) { | |
if (missing(result)) return( | |
utils::`?`(deparse(substitute(condition))) | |
) | |
result <- substitute(result) | |
if (!is.call(result) || !identical(result[[1]], as.symbol(':'))) { | |
stop("Invalid syntax. Expected <condition> ? <if_true> : <if_false>", call. = FALSE) | |
} | |
eval(call("if", condition, result[[2]], result[[3]])) | |
} |
View chomp.md
View recursive-tweet-thread.R
library(rtweet) | |
last_tweet_id <- "1333907891049402371" | |
lookup_thread <- function(status_id, tweets = NULL) { | |
tweet <- rtweet::lookup_tweets(status_id) | |
tweets <- dplyr::bind_rows(tweet, tweets) | |
if (is.na(tweet$reply_to_status_id)) { | |
return(tweets) | |
} else { |
View macos-rstats-laptop-setup.md
App Install Plan
Critical
-
iTerm2
-
Command Line Tools
xcode-select –install
View popular-world-names.R
library(tidyverse) | |
library(rvest) | |
page <- read_html("https://en.wikipedia.org/wiki/List_of_most_popular_given_names") | |
page %>% | |
html_nodes("table") %>% | |
map(html_table, fill = TRUE) %>% | |
map2_dfr(rep(c("male", "female"), 5), ~ mutate(.x, gender = .y)) %>% | |
as_tibble() %>% |
View 00_explanation.md
Setting up RStudio for Oracle pull using odbc on maxOS Catalina
- install unixodbc using homebrew
You can install homebrew here. Once that is done, run this in the terminal.
brew install unixodbc
- Download instant client from Oracle
View xaringan-details-class-expander.js
(function() { | |
var divHTML = document.querySelectorAll(".details"); | |
divHTML.forEach(function (el) { | |
let title = [...el.classList].filter(s => !s.match(/details|open/)) | |
el.outerHTML = '<details ' + | |
(el.classList.contains("open") ? "open " : "") + | |
'class="output"><summary>' + | |
(title.length ? title : 'Details') + | |
'</summary>' + | |
el.innerHTML + |
View xaringanExtra-animate-css-attn-seekers.Rmd
--- | |
title: "animate.css attention seekers with xaringanExtra" | |
author: "Garrick Aden-Buie" | |
output: | |
xaringan::moon_reader: | |
lib_dir: libs | |
seal: false | |
nature: | |
highlightStyle: github | |
highlightLines: true |
View str_replace_all-with-function
library(tidyverse) | |
recipes <- tibble::tribble( | |
~title, ~ingredients, | |
"Banana Bread", "4 bananas", | |
"Banana Bread", "1/2 cup butter", | |
"Banana Bread", "2/3 cup sugar", | |
"Banana Bread", "2 eggs", | |
"Banana Bread", "2 cups flour", | |
"Banana Bread", "1/4 tsp baking soda" |
View ioslides-panelset.Rmd
--- | |
title: "panelset" | |
author: "Garrick Aden-Buie" | |
date: "9/22/2020" | |
output: ioslides_presentation | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = FALSE) | |
``` |
NewerOlder