hil_setup | R Documentation |
This function looks in a directory for HILDA data files with .dta
,
the Stata binary data format, save them as fst files.
The fst files will be used by hil_fetch()
for loading HILDA data.
hil_setup(read_dir, save_dir) make_dict(read_dir, save_dir = NULL) hil_dict()
read_dir |
read directory where the HILDA files that
match this |
save_dir |
a directory to save HILDA files in 'fst' format.
This directory will be added to .Rprofile as |
hil_dict()
returns a data table with many rows and 3 variables:
(character()
) variable names
(list(integer())
) waves that the variable was recorded
(character()
) short description of the variable
make_dict()
returns a data.table contains three
columns: var, label, and wave. But if save_dir
is not
NULL
, the dict will be saved to that location.
This function can take a long time to finish since each HILDA file
is quite large. One option is to use the future package to choose
your parallel backend before running hil_fetch()
. The following
code chuck uses multisession
which creates background R sessions
equal to the number of workers
.
library(future) plan(multisession, workers = 2) # `hil_setup()` can take several minutes to finish. # To monitor its progress, you can wrap the function in # `progressr::with_progress({...}}` like below. progressr::with_progress({ hil_setup(read_dir = "...", save_dir = "...") })
# HILDA data dictionary ## Not run: hil_dict() ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.