divide_by_quantile: Divide variable based on quantiles

Description Usage Arguments Value See Also Examples

View source: R/divide_by_quantile.R

Description

Creates a factor based on equally spaced quantiles of a variable.

Usage

1

Arguments

data

A numeric vector.

n

An integer specifying the number of levels in the factor to be created.

na.rm

A logical vector indicating whether the NA values should be removed before the quantiles are computed.

Value

A vector of class factor indicating in which quantile the element in data belongs.

See Also

stats::quantile().

Examples

1
2
x <- c(sample(1:20, 9), NA)
divide_by_quantile(x, 3)

lvmisc documentation built on April 5, 2021, 5:06 p.m.