read_health_dict | R Documentation |
read_health_dict
reads into R pre-formatted popdata data dictionaries,
while health_dict_to_spec
converts a health dict to a readr spec.
read_health_dict(path, sheet, ...) health_dict_to_spec(health_dict, special = NULL)
path |
Path to the xls/xlsx file. |
sheet |
Sheet to read. Either a string (the name of a sheet), or an
integer (the position of the sheet). Ignored if the sheet is specified via
|
... |
arguments passed to |
health_dict |
a data.frame, output of |
special |
a named list of readr column specifications for columns where you want to override the format in the dictionary file |
read_health_dict
: Files are in .xlsx format and therefore require both a path and sheet
argument. The rest of the function is a thin wrapper around reaxl::read_excel
with some formatting taking place.
health_dict_to_spec
converts a
health dict created by read_health_dict
to a readr spec. This will use the
dictionary to create specifications even for date and datetime columns, and allows
overriding the default column specs by using the special
parameter.
read_health_dict
: A clean data.frame of health data dictionary
health_dict_to_spec
: a named list of readr column specifications
that can be passed on to the col_types
argument of any of the readr
functions, or dat_to_parquet()
and friends.
dict <- read_health_dict(dipr_example("sample_hlth_dict.csv")) dict health_dict_to_spec(dict, special = list(code1 = readr::col_integer()))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.