list_dataset_columns | R Documentation |
Returns the available columns for a specified dataset. This function adapts to different data sources (SQL databases, network files) and handles various dataset-specific requirements like year validation and analytic-ready flags.
list_dataset_columns(
dataset = NULL,
year = 2021,
mykey = "hhsaw",
kingco = TRUE,
analytic_only = FALSE
)
dataset |
Character vector of length 1. Identifies the dataset to be
fetched. Use |
year |
Year(s) of dataset to check. Only applies to BRFSS, HYS, and PUMS data.
For PUMS data, this is limited to a single year (e.g., 2023) or a continuous
5-year period (e.g., 2018:2022). Defaults to |
mykey |
Character vector of length 1 OR a database connection. Identifies
the |
kingco |
Logical. Toggle for King County ( |
analytic_only |
Logical. Controls whether columns outside the analytic
dataset should be returned. Only applies to HYS data. Defaults to
|
This function handles multiple data sources with different requirements:
SQL-based (birth, death, chars): Accessed via HHSAW
Network-based (BRFSS, HYS, PUMS): Need appropriate permissions
Network paths required:
BRFSS (kingco = T): '//dphcifs/APDE-CDIP/BRFSS/prog_all/final_analytic.rds'
BRFSS (kingco = F): '//dphcifs/APDE-CDIP/BRFSS/WA/wa_final_analytic.rds'
HYS: '//dphcifs/APDE-CDIP/HYS/releases/2021/best/hys_cols.csv'
PUMS: '//dphcifs/APDE-CDIP/ACS/PUMS_data/' and subdirectories
A data.table
with dataset-specific columns:
All datasets: 'var.names' (variable names)
BRFSS/HYS/PUMS: Additional 'year(s)' column
HYS only: 'analytic_ready' flag
PUMS only: 'records' indicating household/person level
# SQL-based data
list_dataset_columns('birth')
list_dataset_columns('chars', mykey = 'hhsaw')
list_dataset_columns('death', mykey = 'hhsaw')
# Network-based data
list_dataset_columns('hys', year = 2021, analytic_only = TRUE)
list_dataset_columns('brfss', year = 2014:2023)
list_dataset_columns('pums', year = 2018:2022)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.