powered by
Creates a factor based on equally spaced quantiles of a variable.
divide_by_quantile(data, n, na.rm = TRUE)
A vector of class factor indicating in which quantile the element in data belongs.
factor
data
A numeric vector.
An integer specifying the number of levels in the factor to be created.
A logical vector indicating whether the NA values should be removed before the quantiles are computed.
NA
stats::quantile().
stats::quantile()
x <- c(sample(1:20, 9), NA) divide_by_quantile(x, 3)
Run the code above in your browser using DataLab