Skip to content

Instantly share code, notes, and snippets.

View cbgoodman's full-sized avatar

Chris Goodman cbgoodman

View GitHub Profile
@cbgoodman
cbgoodman / seer_single_year.r
Created May 29, 2024 21:40
R script to download, extract, and create the single year age, SEER U.S. County Population Data dataset
library(tidyverse)
library(data.table)
# import, unzip, and read
# this is for IL, change the url to whichever version you want/need from here:
# https://seer.cancer.gov/popdata/download.html
il_singleage = fread(
"curl https://seer.cancer.gov/popdata/yr1969_2022.singleages/il.1969_2022.singleages.txt.gz | funzip",
colClasses = 'character',
header = FALSE
library("tidyverse")
library("tidycensus")
census_api_key("INSERT_API_KEY")
wright <- get_acs(
state = "MN",
county = "Wright",
geography = "county subdivision",
variables = "B19013_001",
@cbgoodman
cbgoodman / coeffplot.r
Created December 2, 2019 19:48
Example standardized coefplot (by hand)
library(tidyverse)
library(readxl)
plot.data <- read_excel("popgrow-coeff.xlsx", sheet = "popgrow", col_types = c("guess", "numeric", "numeric", "numeric", "guess"))
multiplier <- qnorm(1 - 0.05 / 2)
plot.data <- plot.data %>%
mutate(std.est = estimate * sd,
std.se = se * sd,