lets.transf: Transform values of a vector

Description Usage Arguments Value Author(s) Examples

Description

Transform each element of a vector.

Usage

1
lets.transf(x, y, z, NUMERIC = TRUE)

Arguments

x

A vector to be transformed.

y

levels to be transformed.

z

The value to be atributed to each level (same order as y).

NUMERIC

logical, if TRUE z will be considered numbers.

Value

Return a vector with changed values.

Author(s)

Bruno Vilela

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
status <- sample(c("EN","VU", "NT", "CR", "DD", "LC"), 30, replace=TRUE) 
TE <- "Threatened"
NT <- "Non-Threatened"
new <- c(TE, TE, NT, TE, "Data Deficient", NT)
old <- c("EN","VU", "NT", "CR", "DD", "LC")
statustrans <- lets.transf(status, old, new, NUMERIC=FALSE)


## End(Not run)

letsR documentation built on Oct. 27, 2020, 1:07 a.m.