categorize: Assign categories

View source: R/categorize.R

categorizeR Documentation

Assign categories

Description

Assigns a category to each element of a vector for a given set of threshold values.

Usage

categorize(x, categ, lower = FALSE)

Arguments

x

a numeric, complex, character or logical vector.

categ

a set of threshold values used to assign categories.

lower

a logical. If TRUE threshold values (i.e. values within categ) belongs to the lower category rather than the upper (default behavior).

Value

A vector of categories assigned.

Examples

categorize(stats::runif(40), categ=c(0.5,0.75))
categorize(LETTERS[1:5], categ='C')
categorize(LETTERS[1:5], categ='C',  lower=TRUE)
categorize(LETTERS[floor(5*stats::runif(20))+1], categ=LETTERS[1:5], lower=TRUE)

letiR/letiRmisc documentation built on Sept. 11, 2022, 12:43 a.m.