recode | R Documentation |
superseded
recode()
has been superseded by case_match()
.
Replace old values of a vector with new values.
recode(.x, ..., .default = NULL, .missing = NULL)
.x |
A vector |
... |
A series of |
.default |
The default value if all conditions evaluate to |
.missing |
What missing values should be replaced with |
char_vec <- c("a", "b", "c")
recode(char_vec, a = "Apple", b = "Banana")
num_vec <- 1:3
recode(num_vec, `1` = 10, `2` = 25, .default = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.