Commit 5249452b authored by Maurice A Brookhart's avatar Maurice A Brookhart
Browse files

updating readme files

parent b967175c
library(tidyverse)
library(devtools)
library(usethis)
#
# read in 2010 - 2018 county-level data
# documentation: https://www2.census.gov/programs-surveys/popest/technical-documentation/file-layouts/2010-2018/cc-est2018-alldata.pdf
#
countyCensus = read_csv(url(
"https://www2.census.gov/programs-surveys/popest/datasets/2010-2018/counties/asrh/cc-est2018-alldata.csv"
))
# clean data and define factors
names(countyCensus) <- tolower(names(countyCensus))
countyCensus = countyCensus %>%
select(state, county, stname, ctyname, year, agegrp, tot_pop) %>%
filter(agegrp == 0 & (year<=1 | year >= 4)) %>%
select(-agegrp)
countyCensus = countyCensus %>%
mutate(year = factor(year, labels = c("2010", "2011", "2012",
"2013", "2014", "2015",
"2016", "2017", "2018")),
stname = factor(stname)
)
# Save resulting data in the package
usethis::use_data(countyCensus, overwrite=TRUE)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment