Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
just typing R code...

Garrick Aden-Buie gadenbuie

👨‍💻
just typing R code...
View GitHub Profile
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
Chomp <- R6::R6Class(
  "chomp",
  public = list(
    string = "",
    current = "",
    result = list(),
    initialize = function(string) {
      self$string <- string
      self$current <- string
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

View popular-world-names.R
@gadenbuie
gadenbuie / 00_explanation.md
Created Oct 29, 2020 — forked from MattNickodemus/00_explanation.md
Configure macOS Catalina to connect to Oracle DB using RStudio and odbc library
View 00_explanation.md

Setting up RStudio for Oracle pull using odbc on maxOS Catalina

  1. install unixodbc using homebrew

You can install homebrew here. Once that is done, run this in the terminal.

brew install unixodbc
  1. 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)
```
You can’t perform that action at this time.