| chop_quantiles | R Documentation |
chop_quantiles() chops data by quantiles.
chop_deciles() is a convenience function which chops into deciles.
chop_quantiles(
x,
probs,
...,
left = is.numeric(x),
raw = FALSE,
weights = NULL
)
chop_deciles(x, ...)
brk_quantiles(probs, ..., weights = NULL)
tab_quantiles(x, probs, ..., left = is.numeric(x), raw = FALSE)
tab_deciles(x, ...)
x |
A vector. |
probs |
A vector of probabilities for the quantiles. If |
... |
For |
left |
Logical. Left-closed or right-closed breaks? |
raw |
Logical. Use raw values in labels? |
weights |
|
For non-numeric x, left is set to FALSE by default. This works better
for calculating "type 1" quantiles, since they round down. See
stats::quantile().
If x contains duplicates, consecutive quantiles may be the same number
so that some intervals get merged.
chop_* functions return a factor of the same length as x.
brk_* functions return a function to create breaks.
tab_* functions return a contingency table().
Other chopping functions:
chop(),
chop_equally(),
chop_evenly(),
chop_fn(),
chop_mean_sd(),
chop_n(),
chop_proportions(),
chop_width(),
fillet()
chop_quantiles(1:10, 1:3/4)
chop_quantiles(1:10, c(Q1 = 0, Q2 = 0.25, Q3 = 0.5, Q4 = 0.75))
chop(1:10, brk_quantiles(1:3/4))
chop_deciles(1:10)
# to label by the quantiles themselves:
chop_quantiles(1:10, 1:3/4, raw = TRUE)
# duplicates:
tab_quantiles(c(1, 1, 1, 2, 3), 1:5/5)
set.seed(42)
tab_quantiles(rnorm(100), probs = 1:3/4, raw = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.