library(tidyverse)
x <- list(1, 2, 3)
y <- list(3, 3, 3)
z <- list(100, 200, 300)
j <- function(first, second, third) (first + third) * second
This file contains 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(tidyverse) | |
#census_api_key("YOUR API KEY GOES HERE") | |
#Get an API key by going here: https://api.census.gov/data/key_signup.html | |
# First this tells you what variables are on the ACS | |
v17 <- load_variables(2017, "acs1") | |
This file contains 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
source("https://gist.githubusercontent.com/schaunwheeler/6380637/raw/02d345971e3513f69b30fe2ba262578ac3871fe2/amortize.r") | |
library(tidyverse) | |
set.seed(1028) | |
testdata <- tibble(principal=rnorm(20, 200000, 10000), | |
interest=runif(20, .01, .1), | |
months=rbinom(20, 360, .5)) | |
# This will not work because function is not vectorized | |
# data_withtabs <- testdata %>% | |
# mutate(AmTable=amortize(p_input=principal, i_input=interest, n_months=months)) |
This file contains 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(tmaptools) | |
library(sf) | |
library(dplyr) | |
library(stringr) | |
library(tidycensus) | |
addresses <- c("3040 E Cornwallis Rd, Durham, NC") # This is RTI HQ | |
# Google geocodes lat/lon as 35.906156, -78.864160 |
This file contains 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(tidyverse) | |
set.seed(406) | |
N <- 2000 | |
library(rbenchmark) | |
benchmark( | |
"rowwise"={ | |
df <- tibble(x=runif(N), y=runif(N), z=runif(N)) |
This file contains 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
# https://github.com/rfordatascience/tidytuesday/blob/master/data/2020/2020-03-31/readme.md | |
library(tidyverse) | |
# Get the Data | |
brewing_materials <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-03-31/brewing_materials.csv') | |
beer_taxed <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-03-31/beer_taxed.csv') | |
brewer_size <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-03-31/brewer_size.csv') | |
beer_states <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-03-31/beer_states.csv') |
This file contains 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(tidyverse) | |
library(survey) | |
library(srvyr) | |
data(api) | |
apisrs_mut <- apisrs %>% | |
as_tibble() %>% | |
mutate(stype_factor=parse_factor(as.character(stype), levels=c("E", "M", "H")), |
This file contains 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(tidyverse) | |
library(tidycensus) | |
nyc_counties <- c("005", "047", "061", "081", "085") | |
acsvars <- load_variables(2015, "acs5", cache=TRUE) | |
options(tigris_use_cache = TRUE) | |
nyc_tract <- get_acs(geography="tract", | |
variables=c("B16001_001", "B16001_066", "B16001_067", "B16001_068"), |
This file contains 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" | |
author: "Stephanie" | |
date: "5/25/2021" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) | |
``` |
This file contains 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(tidyverse) | |
library(geofacet) | |
lv19 <- load_variables(2019, "acs1") | |
d20 <- get_decennial( | |
"state", | |
variables=c("HU_Tot"="H1_001N", |
OlderNewer