View source: R/act_make_dict.R
| act_make_dict | R Documentation |
Creates a dataframe and optionally Excel file that can be subsequently used as a dictionary in matchmaker or linelist for assignment of uniform spellings across multiple dataframes
act_make_dict(
vec1,
list1,
excel = TRUE,
filename = "dictionary.xlsx",
method = "osa"
)
vec1 |
Vector designated as correctly spelled (e.g., health facility names in dataframe 1) to which all others will be changed for the purposes of matching |
list1 |
Either a vector or list of vectors that will be used for matching multiple datasets (e.g., health facility names in dataframes 2, 3, and 4) |
excel |
Whether or not to write to Excel, accepts TRUE (default) or FALSE |
filename |
Name to be used for Excel dictionary file, if Excel = TRUE (default is "dictionary.xlsx"; must be written in quotes) |
A database (and optionally an Excel file) showing R's guesses how to change spellings to match those in the specified "good spelling" vector, vec1. Some of the spelling guesses made by R will undoubtedly be incorrect and will have to be edited by hand for use as a dictionary, hence the default writing to Excel. Variable names: (1) change_to: R's guess for the good spelling to use (2) change_from: The "bad spelling" to change (3) goodspell_options_unmatched: The "correctly spelled" variables in vec1 that do not have a match in list1 or a match suggested by the function (4) goodspell_options_all: All of the unique entries in vec1
vec1 <- c("Frank", "Tom", "Jerry")
vec2 <- c("frank", "fraak", "Larry")
vec3 <- c("Frank", "thom", "gerry")
vec4 <- c("Frank", "tom", "Harry")
list1 <- list(vec2, vec3, vec4)
dictionary <- act_make_dict(vec1, list1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.