cut_quantile | R Documentation |
cut_quantile()
is like cut()
, but it calculates intervals
from quantiles such that each interval has approximately the same number of
items from the original vector. x
must have both quantile()
and cut()
methods implemented.
cut_quantile(x, breaks, labels = NULL, ...)
x |
An R object, usually a numeric vector. |
breaks |
A single integer with the number of breaks to use. |
labels |
Labels for the resulting category or |
... |
Further arguments passed to |
A factor()
is returned, unless labels = FALSE
(in this case, a
integer vector is obtained).
# Transform a numeric vector into a factor with 5 levels of same item numbers
vec <- rnorm(20)
fact <- cut_quantile(vec, breaks = 5)
fact
table(fact)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.