This script uses an Amazon EMR Spark cluster with 10 m3.xlarge
instances.
install.packages(devtools)
install.packages(sparklyr)
devtools::install_github("tylermorganwall/rayrender")
system2("hadoop", args = c("fs", "-mkdir", "/rendering"))
library(tidycensus) | |
library(ggiraph) | |
library(tidyverse) | |
library(patchwork) | |
vt_income <- get_acs( | |
geography = "county", | |
variables = "B19013_001", | |
state = "VT", | |
year = 2019, |
library(tidyverse) | |
library(rstan) | |
library(bayesplot) | |
#code | |
model_code <- " | |
data { | |
int<lower = 2> K; // # of categories | |
vector[K] priorprobs; //prior | |
int<lower=0> n_total_1; //total in group 1 |
# cool bash codes | |
# search a directory for all lines that match a pattern (not perfect but useful) ------ | |
## e.g. grep is searching for all lines matching "::" in `R/` to determine package calls | |
## -h hides the file names; -i ignores case | |
## sed -E uses regular expressions to search and match groups; | |
## we then sort and use -u | |
grep -hi :: -R R/* | sed -E 's/(.*)([ ]+[a-z]+::)(.*)/\2/g' | sort -u | |
# COUNT COLUMNS ----------------- |
# install.packages(c("here", "fs", "stringr", "purrr", "git2r")) | |
# to add invisibly in your R profile, open with usethis::edit_r_profile() | |
# then define it in an environment, e.g. | |
# .env <- new.env() | |
# .env$move_slides_to_web <- {function definition} | |
move_slides_to_web <- function(folder = NULL, index = NULL) { | |
if (is.null(folder)) { |
library(tidyverse) | |
lights_dat <- read_csv("https://ckan.dataplatform.nl/dataset/83402c68-1c05-4aa5-ab28-2e99d2bc2261/resource/dc10e0ac-351a-49b6-b3db-d0152c29dc02/download/paal-20180906.csv") | |
pp <- | |
lights_dat %>% | |
filter(latitude > 50) %>% | |
ggplot(aes(x = longitude, y = latitude)) + | |
geom_point(alpha = 0.03, fill = "#FAFAAB", stroke = 0, pch = 21, size = 1.6) + | |
geom_point(alpha = 0.8, fill = "#FAFAAB", stroke = 0, pch = 21, size = 0.2) + |
### ------- Load Packages ---------- ### | |
library("purrr") | |
library("future") | |
library("dplyr") | |
library("randomForest") | |
library("rsample") | |
library("ggplot2") | |
library("viridis") | |
### ------- Helper Functions for map() ---------- ### | |
# breaks CV splits into train (analysis) and test (assessmnet) sets |
As an extension to the blog post React in R, I thought it would be helpful to demonstrate how we can combine a React component with R Shiny.
library(htmltools)
library(shiny)
library(reactR)
library(tidyverse) | |
library(lubridate) | |
library(extrafont) | |
library(kani) | |
library(directlabels) | |
library(gganimate) | |
library(scales) | |
library(tweenr) | |
sea_ice <- read.csv("https://raw.githubusercontent.com/kanishkamisra/sea-ice-extent/master/seaice.csv") %>% select(-Source.Data) |