disc_terciles: Discretize Numeric Vector into Terciles

View source: R/data-prep.R

disc_tercilesR Documentation

Discretize Numeric Vector into Terciles

Description

Converts a numeric vector into an ordered factor with three levels (low, medium, high) using deterministic percent ranks to break ties.

Usage

disc_terciles(x)

Arguments

x

Numeric vector to discretize.

Value

An ordered factor with levels "low", "medium", "high".

Examples

x <- c(1, 2, 3, 4, 5, 6, 7, 8, 9)
disc_terciles(x)

bivarhr documentation built on July 7, 2026, 1:06 a.m.