powered by
Recodes levels of variable from old values to new values. Levels in Old are recoded to levels in New by matching position in these two vectors.
varRecode(Var, Old, New)
A variable to recode.
Vector with original levels of Var
vector with new levels
Returns variable with new levels
recode
# NOT RUN { ##d$rIV1 = varRecode(d$IV1, c(-1,1), c(-.5, .5)) ##d$rIV2 = varRecode(d$IV2, c(1,2,3), c(-.667, .333, .333)) ##d$rIV3 = varRecode(d$IV3, c('A', 'B'), c('C', 'D')) # }
Run the code above in your browser using DataLab