quant_groups: Split Continuous Variable into Quantile Groups

Description Usage Arguments Value Examples

View source: R/quant_groups.R

Description

Splits a continuous variable into quantiles groups. Basically combines quantile and cut into a single function.

Usage

1
quant_groups(x, groups = 5, ...)

Arguments

x

Numeric vector.

groups

Numeric value indicating how many quantile groups should be created.

...

Further arguments to pass to quantile or cut.

Value

Factor variable.

Examples

1
2
3
4
# Convert values from N(0, 1) into quintiles (i.e. 5 groups)
x <- rnorm(1000)
groups <- quant_groups(x, 5)
table(groups)

dvmisc documentation built on May 2, 2019, 5:51 p.m.