Type: | Package |
Title: | Access the 'CDC PLACES' API |
Version: | 1.1.10 |
Maintainer: | Brenden Smith <smit2535@msu.edu> |
Description: | Allows users to seamlessly query several 'CDC PLACES' APIs (https://data.cdc.gov/browse?q=PLACES%20&sortBy=relevance) by geography, state, measure, and release year. This package also contains a function to explore the available measures for each release year. |
License: | MIT + file LICENSE |
URL: | https://github.com/brendensm/CDCPLACES, https://brendensm.github.io/CDCPLACES/ |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.1 |
Suggests: | testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
Imports: | curl, yyjsonr, tigris, sf, stats, zctaCrosswalk |
Depends: | R (≥ 4.1.0) |
NeedsCompilation: | no |
Packaged: | 2025-05-22 14:04:49 UTC; b |
Author: | Brenden Smith [aut, cre] |
Repository: | CRAN |
Date/Publication: | 2025-05-22 14:20:02 UTC |
View the 'CDC PLACES' data dictionary
Description
This function provides the user with a data frame that shows all of the available measures in the PLACES data set and for which release years the measures are included.
Usage
get_dictionary()
Value
a dataframe with the current PLACES data dictionary.
Examples
# First save the data
## Not run:
dictionary <- get_dictionary()
## End(Not run)
# Then view the data frame
# View(dictionary)
Obtain data from the CDC PLACES APIs.
Description
Use this function to access CDC PLACES API data. Measures are sourced from the Behavioral Risk Factor Surveillance System and the American Community Survey ACS.
Usage
get_places(
geography = "county",
state = NULL,
measure = NULL,
county = NULL,
release = "2024",
geometry = FALSE,
cat = NULL,
age_adjust = NULL
)
Arguments
geography |
The level of desired geography. Currently supports 'county', 'census', and 'zcta'. |
state |
Specify the state of the desired data using the two letter abbreviation. Supports multiple states if desired. |
measure |
Specify the measures of the data pull. Supports multiple states if desired. For a full list of available measures, see the function 'get_dictionary'. |
county |
Specify the county of the desired data using the full name of the county, with a capital letter. |
release |
Specify the year of release for the PLACES data set. Currently supports years 2020-2024. |
geometry |
if FALSE (the default), return a regular data frame of PLACES data. If TRUE, uses the tigris package to return an sf data frame with simple feature geometry in the 'geometry' column. |
cat |
Specify the category of measures to return. Overrides the argument 'measure'. Category ID must be used here. Options include 'DISABILT', 'HLTHOUT', 'HLTHSTAT', 'PREVENT', 'RISKBEH', and 'SOCLNEED' (for release 2024). To see all the available categories and their corresponding variables, run get_dictionary. |
age_adjust |
For queries on the county level only. If TRUE, returns only the age-adjusted values. |
Value
A data frame that contains observations for each measure and geographic level.
Examples
## Not run:
get_places(geography = "county", state = "MI", measure = "SLEEP", release = "2023")
get_places(geography = "county", state = c("MI", "OH"),
measure = c("SLEEP", "ACCESS2"), release = "2023")
## End(Not run)