Get a summary variable and calculate percentages
Many variables in the Census and American Community Survey are represented as counts or estimated counts. While count data is useful for some applications, it is often good practice to normalize count data by its denominator to convert it to a proportion or percentage to make clearer comparisons. This is facilitated in tidycensus with the summary_var
argument, which allows users to request that a variable is given its own column in a tidy Census dataset. This value can then be used as the denominator for subsequent calculations of percentages.
Summary question: When the summary_var
parameter is requested in get_acs()
, what information is returned by the function?
This exercise is part of the course
Analyzing US Census Data in R
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Assign Census variables vector to race_vars
___ <- c(White = "B03002_003", Black = "B03002_004", Native = "B03002_005",
Asian = "B03002_006", HIPI = "B03002_007", Hispanic = "B03002_012")