Description Usage Arguments Details Value
View source: R/funs_load_edit.R
Data in SCB .px files often comes in factors if the data is not strictly numeric. E.g years are coded as factors not integers. This at times (often) a nuisance. fix_factors change the class based on the names of the variable using a dictionary mapping class to name. The "classdictionary" can either have two colums named english (due to this function being intended to be applied after translate_names) and one called class or define which colums should be used with fr (from) and to; either by index or by column name.
1 | fix_factors(data, classdic = "default", fr = 2, to = 3)
|
data |
Data frame object of which the vars are to be reclassed. |
classdic |
Either a path to a .csv file or a data frame object. |
fr |
The column in classdic where the names are found |
to |
The column to classdic where class mappings are found |
This function works but could do with a little more work...
Returns a reclassed data frame
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.