Skip to contents

Helper for aligning your data to a standardised dictionary or your own dictionary.

Usage

msf_dict_rename_helper(
  disease,
  name,
  varnames = "data_element_shortname",
  varnames_type,
  rmd,
  template = TRUE,
  copy_to_clipboard = TRUE
)

Arguments

disease

Specify which disease you would like to use. Currently supports "Cholera", "Measles", "Meningitis", "AJS", "Mortality", "Nutrition", "Vaccination_short" and "Vaccination_long".

name

The name of the dictionary stored in the package. The default will use dictionaries from the package. However you can also use dictionaries not stored within this package, to use these: specify nameas path to .xlsx file and set the template = False - nb. this needs to be a dataframe containing varnames and varnames_type. You will also need to specify a path to rmd.

varnames

The name of column that contains variable names. The default set to "data_element_shortname". If dictionary is a survey ("Mortality", "Nutrition", "Vaccination_short" or "Vaccination_long") varnames needs to be "name"`. Otherwise if using your own dictionary then specify.

varnames_type

The name of column that contains the variable type. The default will use "data_element_valuetype" for DHIS2 and "type" for Kobo dictionaries. If you specify your own dictionary then this needs to be the same length as varnames in your dictionary.

rmd

The Rmarkdown template which you would like to compare to. Default is will use those included in the package. However you can also use Rmarkdowns not stored within this package, to use these: specify rmdas path to .rmd file and set template = False; nb. you will need to specify a path to a file in name which contains varnames and varnames_type.

template

If TRUE (default) read in a generic dictionary and Rmarkdown based on the MSF OCA ERB pre-approved template. However you can also specify your own dictionary if this differs substantially, by setting template = FALSE.

copy_to_clipboard

if TRUE (default), the rename template will be copied to the user's clipboard with clipr::write_clip(). If FALSE, the rename template will be printed to the user's console.

Value

A dplyr command used to rename columns in your data frame according to the dictionary