reconhub / linelist

An R package to import, clean, and store case data
https://www.repidemicsconsortium.org/linelist
Other
25 stars 5 forks source link

add dictionary position options for clean_spelling/clean_variable_spelling #99

Closed zkamvar closed 4 years ago

zkamvar commented 4 years ago

clean_spelling currently assumes that the keys are in column 1 and the values are in column 2. Working on the R4EPIs project, I found that it was a bit cumbersome to enforce this because people do not often have their data ordered in this manner.

I would suggest to add two options to clean_spelling() (and, by extension, clean_variable_spelling()) that would indicate the column names or positions of keys and values respectively: from = 1, to = 2

This would allow people to construct their calls like so:

clean_variable_spelling(dat, words, 
                        from = "shortcode", 
                        to = "value", 
                        spelling_vars = "grp", 
                        sort_by = "orders")