Skip to content

Instantly share code, notes, and snippets.

View gadenbuie's full-sized avatar

Garrick Aden-Buie gadenbuie

View GitHub Profile
.pull-left[
```{r plot-label1, eval=FALSE}
# code chunk here
ggplot(iris) +
aes(Sepal.Length,
Sepal.Width,
color = Species) +
geom_point()
```
]
@gadenbuie
gadenbuie / ggplot_tutorial.Rmd
Created September 24, 2018 19:04 — forked from emitanaka/ggplot_tutorial.Rmd
ggplot tutorial with kunoichi + ninjutsu xaringan theme
---
title: "ggplot tutorial"
subtitle: "with kunoichi + ninjutsu theme"
author: "<br><br> Emi Tanaka"
date: "<br>2018/09/16"
output:
xaringan::moon_reader:
lib_dir: libs
css: ["kunoichi", "ninjutsu"]
nature:
@gadenbuie
gadenbuie / plot-it-all.R
Created October 18, 2018 02:54 — forked from EmilHvitfeldt/plot-it-all.R
Plot every since ggplot2 plot
library(ggplot2)
directory <- "~/Desktop/dataviz/"
fs::dir_create(directory)
print.ggplot <- function(x, newpage = is.null(vp), vp = NULL, ...) {
set_last_plot(x)
if (newpage) grid::grid.newpage()
# Record dependency on 'ggplot2' on the display list
# (AFTER grid.newpage())
grDevices::recordGraphics(
@gadenbuie
gadenbuie / plotROC_example.md
Created October 18, 2018 14:01
Demonstrating the use of plotROC

A quick example of how to use the plotROC package.

install.packages("plotROC")
library(tidyverse)
library(plotROC)
---
title: "Presentation Ninja"
subtitle: "⚔<br/>with xaringan"
author: "Yihui Xie"
date: "2016/12/12 (updated: `r Sys.Date()`)"
output:
xaringan::moon_reader:
lib_dir: libs
css:
- default
@gadenbuie
gadenbuie / breaks_tutorial.Rmd
Last active November 30, 2018 15:46 — forked from EvaMaeRey/breaks_tutorial.Rmd
ggplot dplyr reveal breaking
---
title: "ggplot tutorial"
subtitle: "with Emi Tanaka's kunoichi + ninjutsu theme"
author: "<br><br>Gina Reynolds"
date: "<br>2018/09/16"
output:
xaringan::moon_reader:
chakra: libs/remark-latest.min.js
lib_dir: libs
css: ["kunoichi", "ninjutsu"]
@gadenbuie
gadenbuie / get_my_github_stars.R
Last active November 29, 2019 10:55
Get My Starred GitHub Repos
if (!requireNamespace("gh", quietly = TRUE)) {
install.packages("gh")
}
if (!requireNamespace("roomba", quietly = TRUE)) {
library(devtools)
install_github("ropenscilabs/roomba")
}
library(dplyr)
@gadenbuie
gadenbuie / pre-commit
Created December 18, 2018 22:29 — forked from jeroenjanssens/pre-commit
Script that tests your #rstats code before committing to git. When you have failed tests the commit will be aborted. Requires the devtools, testthat, and purrr packages. Name this script `pre-commit`, make it executable, and place it in the .git/hooks subdirectory of your git repository.
#!/usr/bin/env RScript
messages <- purrr::map_chr(devtools::test(),
list("results", 1, "message"))
q("no", status = sum(messages != "success"))
@gadenbuie
gadenbuie / rjdbc_dbplyr_example.R
Last active December 26, 2018 16:37
RJDBC example using ojdb8.jar and dbplyr
# Connect Via RJDBC -------------------------------------------------------
library(RJDBC)
drv <- JDBC("oracle.jdbc.OracleDriver", classPath="~/import/instantclient_12_2/ojdbc8.jar")
con <- dbConnect(drv,"jdbc:oracle:thin:@server:1521:database",
rstudioapi::askForSecret("Username"),
rstudioapi::askForSecret("Database Password"))
dbGetQuery(con,"select count(*) from schema.table")
# Setup dplyr and dbplyr to work with RJDBC -------------------------------
@gadenbuie
gadenbuie / app.R
Last active January 22, 2019 14:29
Tweet embed example
library(shiny)
library(dplyr)
library(rtweet)
tweets <- search_tweets("#rstats", n = 5, include_rts = FALSE)
# https://github.com/mkearney/rtweet/pull/305/files
tweet_embed <- function(screen_name,status_id,...){
stem <- 'https://publish.twitter.com/oembed'