This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code creates an example Nested Column Chart of the type developed by Brittany Rosenau | |
# this code will produce the graphic below if you paste it into R Studio and run it | |
# to run it in a Power BI R visual, just import the csv into Power Query | |
# and then paste in the code below, changing df <- dataset | |
# note that "dataset" is the variable name used by convention in Power BI to call the table | |
# resulting from the previous step | |
# Load necessary libraries | |
library(ggplot2) | |
library(dplyr) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(sf) | |
library(elevatr) | |
library(raster) | |
library(rayshader) | |
library(dplyr) | |
setwd(dirname(rstudioapi::getActiveDocumentContext()$path)) | |
# read in andes shapefile from https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5466557/ | |
# idk exactly what i'm doing yet | |
# get extent we're interested in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Untitled" | |
output: html_document | |
--- | |
```{r include = FALSE} | |
library(tidyverse) | |
library(tidyquant) | |
library(timetk) | |
library(readxl) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(interactive()) { | |
cat("\014") # clear screen | |
cli::cli_text("") | |
cli::cli_text(R.version$version.string) | |
cli::cli_text("") | |
cli::cli_alert_success( | |
paste0( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Kaggle Days SF: Hackathon submission (8th place) | |
# I used the latest version of H2O (3.24.0.1) | |
# Latest stable always here: http://h2o-release.s3.amazonaws.com/h2o/latest_stable.html | |
# H2O 3.24.0.1: http://h2o-release.s3.amazonaws.com/h2o/rel-yates/1/index.html | |
# If you are a Python user, you can use the demo Python code available on the H2O AutoML User Guide | |
# instead: http://docs.h2o.ai/h2o/latest-stable/h2o-docs/automl.html | |
# Unfortunately it was a private competition, so the data is not publicly available! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(tidyr) | |
library(dplyr) | |
library(maps) | |
library(gganimate) | |
WorldData <- map_data('world') | |
#WorldData %>% filter(region != "Antarctica") -> WorldData | |
WorldData <- fortify(WorldData) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load the packages we’re going to be using: | |
# Alongside the usual stuff like tidyverse and magrittr, we’ll be using rvest for some web-scraping, jsonline to parse some JSON, and extrafont to load some nice custom fonts | |
needs(tidyverse, magrittr, rvest, jsonlite, extrafont) | |
# Before we go on, two things to note: | |
# First, on web scraping: | |
# You should always check the terms of the site you are extracting data from, to make sure scraping (often referred to as `crawling`) is not prohibited. One way to do this is to visit the website’s `robots.txt` page, and ensure that a) there is nothing explicitly stating that crawlers are not permitted, and b) ideally, the site simply states that all user agents are permitted (indicated by a line saying `User-Agect: *`). Both of those are the case for our use-case today (see https://www.ultimatetennisstatistics.com/robots.txt). | |
# And second, about those custom fonts: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# devtools::install_github("yixuan/fontr") | |
library(fontr) | |
library(transformr) | |
library(showtext) | |
library(tidyverse) | |
library(gganimate) | |
# use showtext to loading Google fonts (http://www.google.com/fonts) | |
font_add_google("Allura") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidycensus) | |
library(mapdeck) | |
library(tidyverse) | |
token <- "your mapbox token" | |
hv <- get_acs(geography = "tract", | |
variables = "B25077_001", | |
state = "CA", | |
geometry = TRUE) %>% |
NewerOlder