download ACS 5year data from Census API, at County resolution
Source:R/acs_bycounty.R
acs_bycounty.Rd
download ACS 5year data from Census API, at County resolution
Examples
## also see examples for acs_bybg()
# \donttest{
x <- acs_bycounty(myvars = "B03002_003", myst = "NY", yr = 2022) # nhwa
#> Getting data from the 2018-2022 5-year ACS
#> Warning: • You have not set a Census API key. Users without a key are limited to 500
#> queries per day and may experience performance limitations.
#> ℹ For best results, get a Census API key at
#> http://api.census.gov/data/key_signup.html and then supply the key to the
#> `census_api_key()` function to use it throughout your tidycensus session.
#> This warning is displayed once per session.
denom <- acs_bycounty(myvars = "B03002_001", myst = "NY", yr = 2022) # pop
#> Getting data from the 2018-2022 5-year ACS
z = x
z$estimate = x$estimate / denom$estimate
z$moe = 0 # x$moe / denom$estimate # need to calculate using census guidance if at all
# z$variable = "pctnhwa" # not used if myvarnames is given
# plot_bycounty(z, myvarnames = "Percent NonHispanic White Alone (i.e., Not People of Color)",
# labeltype = scales::label_percent()) # requires scales package
# }