quantile_cut: Easy function for splitting numeric variable in quantiles

quantile_cutR Documentation

Easy function for splitting numeric variable in quantiles

Description

Using base/stats functions cut() and quantile().

Usage

quantile_cut(
  x,
  groups,
  y = NULL,
  na.rm = TRUE,
  group.names = NULL,
  ordered.f = FALSE,
  inc.outs = FALSE,
  detail.lst = TRUE
)

Arguments

x

Variable to cut.

groups

Number of groups.

y

alternative vector to draw quantile cuts from. Limits has to be within x. Default is NULL.

na.rm

Remove NA's. Default is TRUE.

group.names

Names of groups to split to. Default is NULL, giving intervals as names.

ordered.f

Set resulting vector as ordered. Default is FALSE.

inc.outs

Flag to include min(x) and max(x) as boarders in case of y!=NULL.

Examples

aa <- as.numeric(sample(1:1000,2000,replace = TRUE))
x <- 1:450
y <- 6:750
summary(quantile_cut(aa,groups=4)) ## Cuts quartiles

agdamsbo/daDoctoR documentation built on Aug. 30, 2022, 4:29 p.m.