View source: R/getCensusData.R
| listCounties | R Documentation |
List available counties for a state
listCounties(
state_fips,
year = 2024,
csv_path = NULL,
cache_dir = NULL,
verbose = FALSE
)
state_fips |
Two-digit FIPS code for the state |
year |
Census year (2020-2024), default 2024 |
csv_path |
Optional path to a previously downloaded census CSV file |
cache_dir |
Optional directory path for caching downloaded census files |
verbose |
Logical, if TRUE prints messages about data loading. Default is FALSE. |
Character vector of county names
# Use the included example data
utah_counties <- listCounties(
state_fips = "49",
year = 2024,
csv_path = getCensusDataPath()
)
# Download from web (requires internet)
utah_counties_web <- listCounties(state_fips = "49", year = 2024)
# With caching
utah_counties_cached <- listCounties(state_fips = "49", cache_dir = "~/census_cache")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.