recategorize: Recategorize a character or numerical vector.

Description Usage Arguments Value Examples

View source: R/data_manipulation.R

Description

Recategorize a character or numerical vector.

Usage

1
recategorize(x, x.new, labels = NA)

Arguments

x

a character or numerical vector.

x.new

a character/numerical vector of the new values for x. x.new can also take a form of a matrix or data frame, where the first column is the original value of x and the second is the new value of x.

Value

a character or numerical vector is recategorized.

Examples

1
2
3
recategorize(c(1,2,5,3,4), c("1" = 1, "2" = 1, "3" = 0))
recategorize(c(1,2,3), cbind(c(1,2,3), c(1,1,0), c(1,-1,0)))
recategorize(c(1,4,2,5,3,NA), data.frame(c(1,2,3), c(1,1,0), c(1, -1, 0)) )

uyenhoang/pplpredict documentation built on May 3, 2019, 2:41 p.m.