msf_dict | R Documentation |
These function produces MSF OCA dictionaries based on DHIS2 (for outbreaks) and Kobo (for surveys) data sets defining the data element name, code, short names, types, and key/value pairs for translating the codes into human-readable format.
msf_dict( disease, name = "MSF-outbreak-dict.xlsx", tibble = TRUE, compact = TRUE, long = TRUE ) msf_dict_survey( disease, name = "MSF-survey-dict.xlsx", tibble = TRUE, compact = TRUE, long = TRUE, template = TRUE )
disease |
Specify which disease you would like to use.
|
name |
the name of the dictionary stored in the package.
|
tibble |
Return data dictionary as a tidyverse tibble (default is TRUE) |
compact |
if |
long |
If @param template Only used for |
template |
(for survey dictionaries): if |
matchmaker::match_df()
gen_data()
msf_dict_survey()
if (require("dplyr") & require("matchmaker")) { withAutoprint({ # You will often want to use MSF dictionaries to translate codes to human- # readable variables. Here, we generate a data set of 20 cases: dat <- gen_data( dictionary = "Cholera", varnames = "data_element_shortname", numcases = 20, org = "MSF" ) print(dat) # We want the expanded dictionary, so we will select `compact = FALSE` dict <- msf_dict(disease = "Cholera", long = TRUE, compact = FALSE, tibble = TRUE) print(dict) # Now we can use matchmaker to filter the data: dat_clean <- matchmaker::match_df(dat, dict, from = "option_code", to = "option_name", by = "data_element_shortname", order = "option_order_in_set" ) print(dat_clean) }) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.