get_data_brfss | R Documentation |
Retrieves Behavioral Risk Factor Surveillance System (BRFSS) data and adjusts survey weights to ensure accurate representation for multi-year analysis.
get_data_brfss(cols = NULL, year = NULL, kingco = TRUE, wt_method = "obs")
cols |
Character vector specifying which columns to include in the
returned data. If NULL, all columns identified by
|
year |
Integer vector specifying which years to include in the data.
If NULL, the most recent year available in the data set will be used. Defaults
to |
kingco |
Logical. |
wt_method |
Character string specifying the name of the method used to rescale the weights when selecting multiple years. Options include:
Defaults to ' |
Note that while get_data_brfss
automatically creates multi-year weights
for all years included in the data download, these weights may not be
appropriate for all analyses. Some BRFSS questions are only asked in specific
years, requiring custom weights to be calculated for those specific time
periods. Please refer to pool_brfss_weights
to learn how to easily re-weight and survey set the data.
As stated in the Value section below, this function will return a
imputationList
when selecting King County Health
Reporting Area (HRA) or region variables. This
is necessary because BRFSS is provided at the ZIP code level and ZIP codes
do not nest perfectly within HRAs (and regions are defined by HRAs). When using
a BRFSS imputationList
as the ph.data
argument
in calc
, the function will properly process the
imputationList
to account for the uncertainty in
allocation of ZIP codes to HRAs. In other words, it is fine if you are
unfamiliar with imputation because calc
will deal with the
details for you.
If 'hra20_id
', hra20_name
', and 'chi_geo_region
'
are not requested: Returns a survey-weighted
dtsurvey
/data.table object with the specified columns,
years, and 'default_wt
' (the rescaled / adjusted weight).
If any of 'hra20_id
', 'hra20_name
', or 'chi_geo_region
'
are requested: Returns an imputationList
comprised of
survey-weighted dtsurvey
/data.table objects with the
specified columns, years, and 'default_wt
' (the rescales / adjusted
weight).
For information regarding the BRFSS ETL process, file locations, etc., see: https://github.com/PHSKC-APDE/BRFSS
## Not run:
# Get data for specific columns and years
brfss_data <- get_data_brfss(
cols = c('chi_sex'),
year = 2019:2022
)
# Get data for all columns for the most recent year
brfss_data <- get_data_brfss()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.