Assigns a category to each element of a vector for a given set of threshold values.
categorize(x, categ, lower = FALSE)
x | a numeric, complex, character or logical vector. |
---|---|
categ | a set of threshold values used to assign categories. |
lower | a logical. If |
A vector of categories assigned.
#> [1] 1 2 2 1 3 2 1 2 2 2 1 1 1 2 1 1 2 3 1 1 2 1 2 2 1 3 3 3 3 1 1 1 1 2 1 3 1 2 #> [39] 1 1categorize(LETTERS[1:5], categ='C')#> [1] 1 1 2 2 2categorize(LETTERS[1:5], categ='C', lower=TRUE)#> [1] 1 1 1 2 2#> [1] 5 2 3 2 3 1 5 3 3 2 3 2 1 3 2 1 2 3 5 2