Skip to contents

Divides the range of a numeric vector by the quantiles provided ('q').

Usage

cut_by_quantile(x, q = seq(0, 1, by = 0.2))

Arguments

x

A numeric vector

q

A numeric vector

Value

A factor vector with the interval range of the quantiles.

Examples


x <- rnorm(10)

cut_by_quantile(x)
#>  [1] (0.0972,0.451]  (-1.03,-0.364]  (-0.364,0.0972] (0.451,2.22]   
#>  [5] (0.0972,0.451]  (-1.03,-0.364]  [-1.76,-1.03]   [-1.76,-1.03]  
#>  [9] (-0.364,0.0972] (0.451,2.22]   
#> 5 Levels: [-1.76,-1.03] (-1.03,-0.364] (-0.364,0.0972] ... (0.451,2.22]