recodev {yarrr} | R Documentation |
recodev
Description
This function takes a vector original.vector, and converts all values in a vector old.values to the values in a new vector new.values.
Usage
recodev(original.vector, old.values, new.values, others = NULL)
Arguments
original.vector |
A vector you want to recode |
old.values |
A vector of length M. |
new.values |
A vector of length M. |
others |
An optional value indicating what to convert all values in original.vector that are not found in old.values. |
Examples
x <- c("y", "y", "XSF", "y", "0", "X", "0", "0", "y", "n", "0", "1", "1")
recodev(original.vector = x,
old.values = c("y", "1", "n", "0"),
new.values = c(1, 1, 0, 0)
)
x <- c("y", "y", "XSF", "y", "0", "X", "0", "0", "y", "n", "0", "1", "1")
recodev(original.vector = x,
old.values = c("y", "1", "n", "0"),
new.values = c(1, 1, 0, 0),
others = NA
)
[Package yarrr version 0.1.5 Index]