Skip to content

Instantly share code, notes, and snippets.

View MattSandy's full-sized avatar
💭
Hungry

Matt Sandy MattSandy

💭
Hungry
View GitHub Profile
@MattSandy
MattSandy / companies.R
Last active August 18, 2021 23:48
Inc. 5000 Fastest Growing Companies
library(tidyverse)
library(jsonlite)
df <- "https://api.inc.com/rest/i5list/2021" %>%
fromJSON() %>%
.$companies %>%
bind_rows() %>%
unnest(article) %>%
select(-editorsPick) %>%
write_csv("inc.csv")
@MattSandy
MattSandy / registered-voters.R
Last active November 7, 2020 03:41
Voter Shift
name,registered_voters_2020,registered_voters_2016
Aitkin,"10,840","10,090"
Anoka,"228,495","206,600"
Becker,"21,396","18,829"
Beltrami,"27,518","24,213"
Benton,"24,688","22,106"
Big Stone,"3,212","3,090"
Blue Earth,"39,978","36,184"
Brown,"16,209","15,052"
Carlton,"22,253","20,424"
@MattSandy
MattSandy / extract_tables_from_pdf.R
Last active October 29, 2020 02:00
Extracts Tables from PDF and puts them into a dataframe
library(tidyverse)
library(pdftools)
week <- 42
mn_counties <- c("Aitkin","Anoka","Becker","Beltrami","Benton","Big Stone","Blue Earth","Brown","Carlton","Carver","Cass","Chippewa","Chisago","Clay","Clearwater","Cook","Cottonwood","Crow Wing","Dakota","Dodge","Douglas","Faribault","Fillmore","Freeborn","Goodhue","Grant","Hennepin","Houston","Hubbard","Isanti","Itasca","Jackson","Kanabec","Kandiyohi","Kittson","Koochiching","Lac qui Parle","Lake","Lake of the Woods","Le Sueur","Lincoln","Lyon","McLeod","Mahnomen","Marshall","Martin","Meeker","Mille Lacs","Morrison","Mower","Murray","Nicollet","Nobles","Norman","Olmsted","Otter Tail","Pennington","Pine","Pipestone","Polk","Pope","Ramsey","Red Lake","Redwood","Renville","Rice","Rock","Roseau","Saint Louis","Scott","Sherburne","Sibley","Stearns","Steele","Stevens","Swift","Todd","Traverse","Wabasha","Wadena","Waseca","Washington","Watonwan","Wilkin","Winona","Wright","Yellow Medicine","Unknown/missing")
location <- paste0("https://www.health.state.mn.us/diseases/
@MattSandy
MattSandy / burritos.js
Created September 28, 2020 01:56
Checks Tacocat for when burritos are available for order.
// Twilio Credentials
const accountSid = "accountSid";
const authToken = "authToken";
//require the Twilio module and create a REST client
const client = require("twilio")(accountSid, authToken);
//END Twilio
const fetch = require("node-fetch");
setInterval(() => {
check_if_available();
@MattSandy
MattSandy / census.R
Last active April 8, 2020 16:45
NYT Covid-19 Data Merged with Census
library(tidycensus)
library(tidyverse)
library(viridisLite)
library(gganimate)
library(patchwork)
us_county_population <- get_estimates(geography = "county",
product = "population",
shift_geo = TRUE, geometry = TRUE,
year = 2018) %>%
@MattSandy
MattSandy / Rplot.png
Last active September 23, 2020 01:04
Vaporwave R Plot
Rplot.png
@MattSandy
MattSandy / South_Korea_COVID-19.R
Created March 17, 2020 01:37
Plot confirmed COVID-19 cases in SK
library(tidyverse)
library(lubridate)
library(ggthemes)
library(forecast)
library(xts)
library(timetk)
future <- 7
confirmed <- read_csv("https://github.com/CSSEGISandData/COVID-19/raw/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Confirmed.csv")
South_Korea <- list()
@MattSandy
MattSandy / usa.R
Created March 12, 2020 16:19
Plots a 7 day forecast for the Coronavirus
library(tidyverse)
library(lubridate)
library(ggthemes)
library(forecast)
library(xts)
library(timetk)
future <- 7
confirmed <- read_csv("https://github.com/CSSEGISandData/COVID-19/raw/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Confirmed.csv")
@MattSandy
MattSandy / crime.R
Created November 13, 2019 16:50
Compares Party with Violent Crime Stats in Top 50 US Cities
library(tidyverse)
library(rvest)
library(magrittr)
# Functions ---------------------------------------------------------------
dfmd <- function(df) {
md <- paste(names(df), collapse = " | ")
md %<>% append(rep("---",length(names(df))) %>% paste(collapse = "|"))
for(i in 1:nrow(df)) {
@MattSandy
MattSandy / run.R
Created September 13, 2019 15:04
Third Democratic Debate
library(tidyverse)
library(rvest)
library(data.table)
library(quanteda)
library(magrittr)
library(ggthemes)
url <- "https://www.washingtonpost.com/" %>%
paste0("politics/2019/09/13/transcript-third-democratic-debate/")
transcript <- url %>% read_html %>%