US Census API
API key request and package installation
- If you haven’t already, request an API key here: https://api.census.gov/data/key_signup.html
- Install the following R packages. If prompted to update other packages, select “None”:
install.packages(c("tidycensus", "DT"))
Using tidycensus
## load packages: tidycensus, sf, DT, tmap
## initialize census api key
## view acs variables
## get data, assign to a variable
## view in psuedo-spreadsheet form
## create a searchable web table
## search it for "median family income"
## get data at the county level for Wisconsin, store in a variable!
## get the same data at the county level for two other states!
## get data for a different variable of interest and at a different geometry