View source: R/bruceR-stats_1_basic.R
RECODE | R Documentation |
A wrapper of car::recode()
.
RECODE(var, recodes)
var |
Variable (numeric, character, or factor). |
recodes |
A character string definine the rule of recoding. e.g., |
A vector of recoded variable.
d = data.table(var=c(NA, 0, 1, 2, 3, 4, 5, 6))
added(d, {
var.new = RECODE(var, "lo:1=0; c(2,3)=1; 4=2; 5:hi=3; else=999")
})
d
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.