Hi,
I want to use a mapping table, that would help to change cell values for each variable in a structured and systematic way for a whole data frame.
My mapping table looks like this:
mapping_df <- data.frame(
VarName = c("Var1", "Var1", "Var1")
, RangeFrom = c("A", "B", "b")
, RangeTo = c("A", "B", "b")
, Label = c("A", "B", "B"))
A column from the main data frame
df_initial <- data.frame( Var1 = c("A", "B", "b", "A", "B", "b"))
The end result should look like this
df_final <- data.frame( Var1 = c("A", "B", "B", "A", "B", "B"))
The actual dataframe could be up to 15mil rows and 100 columns. Hence the mapping should be an efficient process.
I created the tables above with character columns in mind, but there will be ranges for numeric values. Perhaps keep the numeric mapping on a side for now.
Thanks