Skip to content

Commit e03a18d

Browse files
Add ACS 2019 data to county_complete and add a new county_2019 data set (#3)
* Add ACS 2019 data to county_complete and add a new county_2019 data set * Remove non-ASCII characters * Update test on county_complete and create tests for county_2019 * Add news, update pkgdown * Don't need dplyr for this example Co-authored-by: Mine Çetinkaya-Rundel <cetinkaya.mine@gmail.com>
1 parent 7c58abd commit e03a18d

13 files changed

Lines changed: 148694 additions & 6 deletions

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# usdata (development version)
22

3+
* Extended county_complete for new ACS 2019 data.
4+
* Added a county_2019 data set for many ACS 2019 variables.
5+
36
# usdata 0.1.0
47

58
* Added a `NEWS.md` file to track changes to the package.

R/data-county_2019.R

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#' American Community Survey 2019
2+
#'
3+
#' Data for 3142 counties in the United States with many variables
4+
#' of the 2019 American Community Survey.
5+
#'
6+
#'
7+
#' @name county_2019
8+
#' @docType data
9+
#' @format A data frame with 3142 observations on the following 95 variables.
10+
#' \describe{
11+
#' \item{state}{State.}
12+
#' \item{name}{County name.}
13+
#' \item{fips}{FIPS code.}
14+
#' \item{median_individual_income}{Median individual income (2019).}
15+
#' \item{median_individual_income_moe}{Margin of error for \code{median_individual_income}.}
16+
#' \item{pop}{2019 population.}
17+
#' \item{pop_moe}{Margin of error for \code{pop}.}
18+
#' \item{white}{Percent of population that is white alone (2015-2019).}
19+
#' \item{white_moe}{Margin of error for \code{white}.}
20+
#' \item{black}{Percent of population that is black alone (2015-2019).}
21+
#' \item{black_moe}{Margin of error for \code{black}.}
22+
#' \item{native}{Percent of population that is Native American alone (2015-2019).}
23+
#' \item{native_moe}{Margin of error for \code{native}.}
24+
#' \item{asian}{Percent of population that is Asian alone (2015-2019).}
25+
#' \item{asian_moe}{Margin of error for \code{asian}.}
26+
#' \item{pac_isl}{Percent of population that is Native Hawaiian or other Pacific Islander alone (2015-2019).}
27+
#' \item{pac_isl_moe}{Margin of error for \code{pac_isl}.}
28+
#' \item{other_single_race}{Percent of population that is some other race alone (2015-2019).}
29+
#' \item{other_single_race_moe}{Margin of error for \code{other_single_race}.}
30+
#' \item{two_plus_races}{Percent of population that is two or more races (2015-2019).}
31+
#' \item{two_plus_races_moe}{Margin of error for \code{two_plus_races}.}
32+
#' \item{hispanic}{Percent of population that identifies as Hispanic or Latino (2015-2019).}
33+
#' \item{hispanic_moe}{Margin of error for \code{hispanic}.}
34+
#' \item{white_not_hispanic}{Percent of population that is white alone, not Hispanic or Latino (2015-2019).}
35+
#' \item{white_not_hispanic_moe}{Margin of error for \code{white_not_hispanic}.}
36+
#' \item{median_age}{Median age (2015-2019).}
37+
#' \item{median_age_moe}{Margin of error for \code{median_age}.}
38+
#' \item{age_under_5}{Percent of population under 5 (2015-2019).}
39+
#' \item{age_under_5_moe}{Margin of error for \code{age_under_5}.}
40+
#' \item{age_over_85}{Percent of population 85 and over (2015-2019).}
41+
#' \item{age_over_85_moe}{Margin of error for \code{age_over_85}.}
42+
#' \item{age_over_18}{Percent of population 18 and over (2015-2019).}
43+
#' \item{age_over_18_moe}{Margin of error for \code{age_over_18}.}
44+
#' \item{age_over_65}{Percent of population 65 and over (2015-2019).}
45+
#' \item{age_over_65_moe}{Margin of error for \code{age_over_65}.}
46+
#' \item{mean_work_travel}{Mean travel time to work (2015-2019).}
47+
#' \item{mean_work_travel_moe}{Margin of error for \code{mean_work_travel}.}
48+
#' \item{persons_per_household}{Persons per household (2015-2019)}
49+
#' \item{persons_per_household_moe}{Margin of error for \code{persons_per_household}.}
50+
#' \item{avg_family_size}{Average family size (2015-2019).}
51+
#' \item{avg_family_size_moe}{Margin of error for \code{avg_family_size}.}
52+
#' \item{housing_one_unit_structures}{Percent of housing units in 1-unit structures (2015-2019).}
53+
#' \item{housing_one_unit_structures_moe}{Margin of error for \code{housing_one_unit_structures}.}
54+
#' \item{housing_two_unit_structures}{Percent of housing units in multi-unit structures (2015-2019).}
55+
#' \item{housing_two_unit_structures_moe}{Margin of error for \code{housing_two_unit_structures}.}
56+
#' \item{housing_mobile_homes}{Percent of housing units in mobile homes and other types of units (2015-2019).}
57+
#' \item{housing_mobile_homes_moe}{Margin of error for \code{housing_mobile_homes}.}
58+
#' \item{median_individual_income_age_25plus}{Median individual income (2019 dollars, 2015-2019).}
59+
#' \item{median_individual_income_age_25plus_moe}{Margin of error for \code{median_individual_income_age_25plus}.}
60+
#' \item{hs_grad}{Percent of population 25 and older that is a high school graduate (2015-2019).}
61+
#' \item{hs_grad_moe}{Margin of error for \code{hs_grad}.}
62+
#' \item{bachelors}{Percent of population 25 and older that earned a Bachelor's degree or higher (2015-2019).}
63+
#' \item{bachelors_moe}{Margin of error for \code{bachelors}.}
64+
#' \item{households}{Total households (2015-2019).}
65+
#' \item{households_moe}{Margin of error for \code{households}.}
66+
#' \item{households_speak_spanish}{Percent of households speaking Spanish (2015-2019).}
67+
#' \item{households_speak_spanish_moe}{Margin of error for \code{households_speak_spanish}.}
68+
#' \item{households_speak_other_indo_euro_lang}{Percent of households speaking other Indo-European language (2015-2019).}
69+
#' \item{households_speak_other_indo_euro_lang_moe}{Margin of error for \code{households_speak_other_indo_euro_lang}.}
70+
#' \item{households_speak_asian_or_pac_isl}{Percent of households speaking Asian and Pacific Island language (2015-2019).}
71+
#' \item{households_speak_asian_or_pac_isl_moe}{Margin of error for \code{households_speak_asian_or_pac_isl}.}
72+
#' \item{households_speak_other}{Percent of households speaking non European or Asian/Pacific Island language (2015-2019).}
73+
#' \item{households_speak_other_moe}{Margin of error for \code{households_speak_other}.}
74+
#' \item{households_speak_limited_english}{Percent of limited English-speaking households (2015-2019).}
75+
#' \item{households_speak_limited_english_moe}{Margin of error for \code{households_speak_limited_english}.}
76+
#' \item{poverty}{Percent of population below the poverty level (2015-2019).}
77+
#' \item{poverty_moe}{Margin of error for \code{poverty}.}
78+
#' \item{poverty_under_18}{Percent of population under 18 below the poverty level (2015-2019).}
79+
#' \item{poverty_under_18_moe}{Margin of error for \code{poverty_under_18}.}
80+
#' \item{poverty_65_and_over}{Percent of population 65 and over below the poverty level (2015-2019).}
81+
#' \item{poverty_65_and_over_moe}{Margin of error for \code{poverty_65_and_over}.}
82+
#' \item{mean_household_income}{Mean household income (2019 dollars, 2015-2019).}
83+
#' \item{mean_household_income_moe}{Margin of error for \code{mean_household_income}.}
84+
#' \item{per_capita_income}{Per capita money income in past 12 months (2019 dollars, 2015-2019).}
85+
#' \item{per_capita_income_moe}{Margin of error for \code{per_capita_income}.}
86+
#' \item{median_household_income}{Median household income (2015-2019).}
87+
#' \item{median_household_income_moe}{Margin of error for \code{median_household_income}.}
88+
#' \item{veterans}{Percent among civilian population 18 and over that are veterans (2015-2019).}
89+
#' \item{veterans_moe}{Margin of error for \code{veterans}.}
90+
#' \item{unemployment_rate}{Unemployment rate among those ages 20-64 (2015-2019).}
91+
#' \item{unemployment_rate_moe}{Margin of error for \code{unemployment_rate}.}
92+
#' \item{uninsured}{Percent of civilian noninstitutionalized population that is uninsured (2015-2019).}
93+
#' \item{uninsured_moe}{Margin of error for \code{uninsured}.}
94+
#' \item{uninsured_under_6}{Percent of population under 6 years that is uninsured (2015-2019).}
95+
#' \item{uninsured_under_6_moe}{Margin of error for \code{uninsured_under_6}.}
96+
#' \item{uninsured_under_19}{Percent of population under 19 that is uninsured (2015-2019).}
97+
#' \item{uninsured_under_19_moe}{Margin of error for \code{uninsured_under_19}.}
98+
#' \item{uninsured_65_and_older}{Percent of population 65 and older that is uninsured (2015-2019).}
99+
#' \item{uninsured_65_and_older_moe}{Margin of error for \code{uninsured_65_and_older}.}
100+
#' \item{household_has_computer}{Percent of households that have desktop or laptop computer (2015-2019).}
101+
#' \item{household_has_computer_moe}{Margin of error for \code{household_has_computer}.}
102+
#' \item{household_has_smartphone}{Percent of households that have smartphone (2015-2019).}
103+
#' \item{household_has_smartphone_moe}{Margin of error for \code{household_has_smartphone}.}
104+
#' \item{household_has_broadband}{Percent of households that have broadband internet subscription (2015-2019).}
105+
#' \item{household_has_broadband_moe}{Margin of error for \code{household_has_broadband}.}
106+
#' }
107+
#' @source The data were downloaded via the \code{tidycensus} R package.
108+
#' @keywords datasets
109+
#' @seealso \code{\link{county}}, \code{\link{county_complete}}
110+
#' @examples
111+
#'
112+
#' library(ggplot2)
113+
#'
114+
#' ggplot(county_2019,
115+
#' aes(x = hs_grad, y = median_individual_income,
116+
#' size = sqrt(pop) / 1000)) +
117+
#' geom_point(alpha = 0.5) +
118+
#' scale_color_discrete(na.translate = FALSE) +
119+
#' guides(size = FALSE) +
120+
#' labs(
121+
#' x = "Percentage of population graduated from high school",
122+
#' y = "Median individual income"
123+
#' )
124+
"county_2019"

R/data-county_complete.R

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#' United States Counties
22
#'
3-
#' Data for 3143 counties in the United States.
3+
#' Data for 3142 counties in the United States.
44
#'
55
#'
66
#' @name county_complete
77
#' @docType data
8-
#' @format A data frame with 3143 observations on the following 111 variables.
8+
#' @format A data frame with 3142 observations on the following 188 variables.
99
#' \describe{
1010
#' \item{state}{State.}
1111
#' \item{name}{County name.}
@@ -149,12 +149,59 @@
149149
#' \item{employed_2017}{Number of civilians employed in 2017.}
150150
#' \item{unemployed_2017}{Number of civilians unemployed in 2017.}
151151
#' \item{unemployment_rate_2017}{Unemployment rate in 2017.}
152+
#' \item{median_individual_income_2019}{Median individual income (2019).}
153+
#' \item{pop_2019}{2019 population.}
154+
#' \item{white_2019}{Percent of population that is white alone (2015-2019).}
155+
#' \item{black_2019}{Percent of population that is black alone (2015-2019).}
156+
#' \item{native_2019}{Percent of population that is Native American alone (2015-2019).}
157+
#' \item{asian_2019}{Percent of population that is Asian alone (2015-2019).}
158+
#' \item{pac_isl_2019}{Percent of population that is Native Hawaiian or other Pacific Islander alone (2015-2019).}
159+
#' \item{other_single_race_2019}{Percent of population that is some other race alone (2015-2019).}
160+
#' \item{two_plus_races_2019}{Percent of population that is two or more races (2015-2019).}
161+
#' \item{hispanic_2019}{Percent of population that identifies as Hispanic or Latino (2015-2019).}
162+
#' \item{white_not_hispanic_2019}{Percent of population that is white alone, not Hispanic or Latino (2015-2019).}
163+
#' \item{median_age_2019}{Median age (2015-2019).}
164+
#' \item{age_under_5_2019}{Percent of population under 5 (2015-2019).}
165+
#' \item{age_over_85_2019}{Percent of population 85 and over (2015-2019).}
166+
#' \item{age_over_18_2019}{Percent of population 18 and over (2015-2019).}
167+
#' \item{age_over_65_2019}{Percent of population 65 and over (2015-2019).}
168+
#' \item{mean_work_travel_2019}{Mean travel time to work (2015-2019).}
169+
#' \item{persons_per_household_2019}{Persons per household (2015-2019)}
170+
#' \item{avg_family_size_2019}{Average family size (2015-2019).}
171+
#' \item{housing_one_unit_structures_2019}{Percent of housing units in 1-unit structures (2015-2019).}
172+
#' \item{housing_two_unit_structures_2019}{Percent of housing units in multi-unit structures (2015-2019).}
173+
#' \item{housing_mobile_homes_2019}{Percent of housing units in mobile homes and other types of units (2015-2019).}
174+
#' \item{median_individual_income_age_25plus_2019}{Median individual income (2019 dollars, 2015-2019).}
175+
#' \item{hs_grad_2019}{Percent of population 25 and older that is a high school graduate (2015-2019).}
176+
#' \item{bachelors_2019}{Percent of population 25 and older that earned a Bachelor's degree or higher (2015-2019).}
177+
#' \item{households_2019}{Total households (2015-2019).}
178+
#' \item{households_speak_spanish_2019}{Percent of households speaking Spanish (2015-2019).}
179+
#' \item{households_speak_other_indo_euro_lang_2019}{Percent of households speaking other Indo-European language (2015-2019).}
180+
#' \item{households_speak_asian_or_pac_isl_2019}{Percent of households speaking Asian and Pacific Island language (2015-2019).}
181+
#' \item{households_speak_other_2019}{Percent of households speaking non European or Asian/Pacific Island language (2015-2019).}
182+
#' \item{households_speak_limited_english_2019}{Percent of limited English-speaking households (2015-2019).}
183+
#' \item{poverty_2019}{Percent of population below the poverty level (2015-2019).}
184+
#' \item{poverty_under_18_2019}{Percent of population under 18 below the poverty level (2015-2019).}
185+
#' \item{poverty_65_and_over_2019}{Percent of population 65 and over below the poverty level (2015-2019).}
186+
#' \item{mean_household_income_2019}{Mean household income (2019 dollars, 2015-2019).}
187+
#' \item{per_capita_income_2019}{Per capita money income in past 12 months (2019 dollars, 2015-2019).}
188+
#' \item{median_household_income_2019}{Median household income (2015-2019).}
189+
#' \item{veterans_2019}{Percent among civilian population 18 and over that are veterans (2015-2019).}
190+
#' \item{unemployment_rate_2019}{Unemployment rate among those ages 20-64 (2015-2019).}
191+
#' \item{uninsured_2019}{Percent of civilian noninstitutionalized population that is uninsured (2015-2019).}
192+
#' \item{uninsured_under_6_2019}{Percent of population under 6 years that is uninsured (2015-2019).}
193+
#' \item{uninsured_under_19_2019}{Percent of population under 19 that is uninsured (2015-2019).}
194+
#' \item{uninsured_65_and_older_2019}{Percent of population 65 and older that is uninsured (2015-2019).}
195+
#' \item{household_has_computer_2019}{Percent of households that have desktop or laptop computer (2015-2019).}
196+
#' \item{household_has_smartphone_2019}{Percent of households that have smartphone (2015-2019).}
197+
#' \item{household_has_broadband_2019}{Percent of households that have broadband internet subscription (2015-2019).}
152198
#' }
153199
#' @source The data prior to 2011 was from \url{http://census.gov},
154200
#' though the exact page it came from is no longer available.
155201
#'
156202
#' More recent data comes from the following sources.
157203
#' \itemize{
204+
#' \item Downloaded via the \code{tidycensus} R package.
158205
#' \item Download links for spreadsheets were found on
159206
#' \url{https://www.ers.usda.gov/data-products/county-level-data-sets/download-data}
160207
#' \item Unemployment - Bureau of Labor Statistics - LAUS data - \url{https://www.bls.gov/lau}.

_pkgdown.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ reference:
2020
contents:
2121
- county_complete
2222
- county
23+
- county_2019
2324
- govrace10
2425
- houserace10
2526
- prrace08
2627
- senaterace10
2728
- state_stats
29+
- urban_owner
2830
- urban_rural_pop
2931
- vote_nsa
3032
- voter_count

0 commit comments

Comments
 (0)