This function transforms a quantitative variable into a qualitative
one by breaking it into classes with the same frequencies.
quant.cut(var, nbclass, include.lowest = TRUE, right = FALSE, dig.lab = 5, ...)
Arguments
- var
variable to transform
- nbclass
number of classes
- include.lowest
argument passed to the cut
function
- right
argument passed to the cut
function
- dig.lab
argument passed to the cut
function
- ...
arguments passed to the cut
function
Value
The result is a factor.
Details
This is just a simple wrapper around the cut
and quantile
functions.
Examples
data(iris)
sepal.width3cl <- quant.cut(iris$Sepal.Width,3)
table(sepal.width3cl)
#> sepal.width3cl
#> [2,2.9) [2.9,3.2) [3.2,4.4]
#> 47 47 56