cutQuantile: Convert Numeric to Quantile-Split Factor

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Convert Numeric to Quantile-Split Factor

Usage

1
2
cutQuantile(x, quantiles, labels = paste(1:quantiles), na.rm = FALSE,
  type = 7)

Arguments

x

Numeric vector which is to be converted to a factor by splitting into quantiles.

quantiles

Integer number of quantiles desired (3 = tertiles, 4 = quartiles, etc.).

labels

Character vector of labels for the levels of the resulting category. By default, labels are constructed by converting the quantile integer codes to a character vector. If labels = FALSE, simple integer codes are returned instead of a factor.

na.rm

Logical, if TRUE any NA and NaNs are removed from x before the quantiles are computed.

Value

A factor is returned, unless labels = FALSE which results in an integer vector of level codes.

Examples

1
table(cutQuantile(1:100, 4))

rebelrebel04/xplor documentation built on May 27, 2019, 4:01 a.m.