hil_fetch | R Documentation |
Fetch HILDA data from the HILDA fst files created by hil_setup()
.
To set default variables for hil_fetch()
to fetch see hil_user_default_vars()
.
hil_fetch( years = NULL, vars = NULL, new_varnames = NULL, add_population_weight = TRUE, add_basic_vars = TRUE, add_geography = FALSE, hilda_fst_dir = ifelse(!is.null(getOption("HILDA_FST")), getOption("HILDA_FST"), get_hilda_fst_path()) )
years |
This argument allow you to specify the years of HILDA
that you like to load instead of using alphabets.
The first wave of HILDA was in 2001 and known as wave 'a',
and the following year was wave 'b'. To load multiple waves
you can be put use a numeric vector (e.g., |
vars |
a vector containing all desired variable names to be loaded. vars can be set to "all" to fetch all columns. This may take a long time to load |
new_varnames |
a vector contains character names with its length equals length of |
add_population_weight |
take a logical value whether to add cross-sectional responding person weight column and enumerated weight column to the data |
add_basic_vars |
take a logical value whether to add hgage (age), hgsex (sex), mrcurr (marital status) and hhrih (relationship in household) to the data |
add_geography |
take a logical value whether to add hhsgcc (Greater statistical region) to the data |
hilda_fst_dir |
a directory where HILDA files in fst format are stored
by |
a data.table object
## Not run: summary(hil_fetch(2011)) summary(hil_fetch(2011:2012, vars = "losat")) # Query all variables that start with 'hs' (Housing) summary(hil_fetch(2011, vars = hil_vars("^hs"))) # Query all variables with the word 'coronavirus' in their variable description. summary(hil_fetch(2020, vars = hil_labs("coronavirus"))) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.