recodevar {doBy} | R Documentation |
Recodes a variable with levels, say '1','2' to a variable with levels, say 'a', 'b'
recodevar(var, src, tgt)
var |
The variable to be recoded |
src |
The source levels: the present levels of var |
tgt |
The target levels: the new levels of var |
A new variable
x <- c("dec","jan","feb","mar","apr","may") src1 <- list(c("dec","jan","feb"), c("mar","apr","may")) tgt1 <- list("winter","spring") recodevar(x,src=src1,tgt=tgt1)