View source: R/divide_by_quantile.R
divide_by_quantile | R Documentation |
Creates a factor based on equally spaced quantiles of a variable.
divide_by_quantile(data, n, na.rm = TRUE)
data |
A numeric vector. |
n |
An integer specifying the number of levels in the factor to be created. |
na.rm |
A logical vector indicating whether the |
A vector of class factor
indicating in which quantile the
element in data
belongs.
stats::quantile()
.
x <- c(sample(1:20, 9), NA)
divide_by_quantile(x, 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.