Skip to content

Instantly share code, notes, and snippets.

View tysonwepprich's full-sized avatar

Tyson Wepprich tysonwepprich

  • North Carolina State University
  • Raleigh, NC
View GitHub Profile
# Thanks to @greghirson who totally knocked this out of the park!
# Based on his work, here's a simple script to pull monthly prices from the USDA NASS website.
library(RCurl)
library(XML)
x <- postForm(uri = "http://quickstats.nass.usda.gov/uuid/encode",
source_desc = "SURVEY", sector_desc="CROPS",
group_desc="FIELD CROPS", commodity_desc="CORN",
statisticcat_desc="PRICE RECEIVED",
@tysonwepprich
tysonwepprich / mapStrava.R
Last active January 4, 2016 02:32
Maps activity data from Strava .gpx files for runs, rides, and walks
# maps of my Strava data
# code modified from Xavi Gimenez
# http://www.xavigimenez.net/blog/2015/04/mapping-3-years-of-running-workouts/
library(plotKML)
library(ggplot2)
library(ggmap)
library(stringr)
library(lubridate)
@tysonwepprich
tysonwepprich / monarch_reanalysis.R
Created March 1, 2019 15:52
Reanalysis of monarch trends reported in Boyle et al. 2019
# Start with all Lepidoptera museum records from
# Boyle, J., H. Dalgleish, and J. Puzey. 2019a.
# Data from: Monarch butterfly and milkweed declines substantially predate
# the use of genetically modified crops. Dryad Digital Repository.
# https://datadryad.org/resource/doi:10.5061/dryad.sk37gd2
# these data were downloaded, cleaned, and saved with code provided in Dryad:
# PART 1.1 Filtering museum data.R
lep <- readRDS("lep_records.rds")
@tysonwepprich
tysonwepprich / babyELO.R
Created March 23, 2022 20:04
Babynames Elo rating system
# Install these packages if you don't have them
library(dplyr)
library(tidyr)
library(ggplot2)
library(elo)
library(ggrepel)
'%!in%' <- function(x,y)!('%in%'(x,y))
# babynames <- read.csv("data/national.csv", header = TRUE, stringsAsFactors = FALSE) # From SS admin download
babynames <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-03-22/babynames.csv')