quant_groups {dvmisc} | R Documentation |
Split Continuous Variable into Quantile Groups
Description
Splits a continuous variable into quantiles groups. Basically combines
quantile
and cut
into a single
function. Note that create_qgroups
will likely supersede this
function in future versions of dvmisc.
Usage
quant_groups(x, groups = 4, probs = NULL, quantile.list = NULL,
cut.list = NULL)
Arguments
x |
Numeric vector. |
groups |
Numeric value specifying number of quantile groups. |
probs |
Numeric vector specifying probabilities. |
quantile.list |
Arguments to pass to |
cut.list |
Arguments to pass to |
Value
Factor variable.
Examples
# Convert values from N(0, 1) into quintiles (i.e. 5 groups)
x <- rnorm(1000)
groups <- quant_groups(x, 5)
table(groups)
[Package dvmisc version 1.1.4 Index]