as_imputed_brfss | R Documentation |
Converts a modified BRFSS dtsurvey
/data.table back into
a imputationList
by creating multiple imputed datasets
for HRA and region assignments. This is necessary after modifying variables in
BRFSS data that contains HRA or region variables.
as_imputed_brfss(
ph.data,
impute_cols = c("hra20_id", "hra20_name", "chi_geo_region")
)
ph.data |
A |
impute_cols |
Character vector specifying which geographic imputation
columns to retain in the output. Must be some combination of
|
When working with BRFSS data that includes Health Reporting Area (HRA) or region
variables, modifications to the data must be made on a single data.table.
After modifications are complete, this function recreates the proper
imputationList
structure required for analysis of
HRA and region variables.
This function:
Creates 10 copies of your modified dataset
Assigns different HRA IDs to each copy based on ZIP code probabilities
Adds corresponding HRA names and region assignments
Combines the copies into an imputationList
Returns an imputationList
containing 10 imputed datasets,
each a survey-weighted dtsurvey
/data.table with
different HRA and region assignments based on ZIP code probabilities.
as_table_brfss
for converting an imputationList to a
single data.table
## Not run:
# Starting with a modified BRFSS data.table
brfss_table[, age_category := fcase(
age %in% 18:66, "working age",
age >= 67, "retirement age",
default = NA_character_
)]
# Convert back to imputationList for analysis
brfss_imputed <- as_imputed_brfss(brfss_table)
# Now ready for analysis with rads::calc()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.