recode | R Documentation |
Recodes values in a vector based on original and new values provided as two vectors.
recode(x, oldvalue, newvalue)
x |
A vector with values to be replaced. |
oldvalue |
A vector of original values to be recoded. |
newvalue |
A vector of replacement values of the same length as oldvalue. |
A vector of same length as input.
Nick Bond <n.bond@latrobe.edu.au>
x<-seq(1:10) recode(x, c(1,5,10), c(-1,-5,-10))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.