To get started working with tidycensus, users should load the package along with the tidyverse package, and set their Census API key. A key can be obtained from http://api.census.gov/data/key_signup.html.
library(tidycensus)
library(tidyverse)
census_api_key("60f99010e1e6302aa6cd4463be9147355567efac")
vt <- get_acs(geography = "county subdivision",
variables = c(Medianrent = "DP04_0005"),
state = "NH",
county = "grafton")
vt
## # A tibble: 40 x 5
## GEOID NAME variable estimate moe
## <chr> <chr> <chr> <dbl> <dbl>
## 1 3300900580 Alexandria town, Grafton County, New Ham… Medianre… 0 28.4
## 2 3300902020 Ashland town, Grafton County, New Hampsh… Medianre… 3 4.7
## 3 3300903940 Bath town, Grafton County, New Hampshire Medianre… 0 35.3
## 4 3300905060 Benton town, Grafton County, New Hampshi… Medianre… 0 73.6
## 5 3300905460 Bethlehem town, Grafton County, New Hamp… Medianre… 8 9.2
## 6 3300907540 Bridgewater town, Grafton County, New Ha… Medianre… 0 35.3
## 7 3300907700 Bristol town, Grafton County, New Hampsh… Medianre… 7.8 8.6
## 8 3300908660 Campton town, Grafton County, New Hampsh… Medianre… 0 7.1
## 9 3300908980 Canaan town, Grafton County, New Hampshi… Medianre… 0 8.1
## 10 3300918740 Dorchester town, Grafton County, New Ham… Medianre… 0 62.2
## # … with 30 more rows
v17 <- load_variables(2017, "acs5/profile", cache = TRUE)
View(v17)
One may search variables in different datasets at Census Bureau