cut_numeric_leftclosed: Wrapper for 'cut()' with 'labels = FALSE', 'right = FALSE'

View source: R/cut_numeric_leftclosed.R

cut_numeric_leftclosedR Documentation

Wrapper for cut() with labels = FALSE, right = FALSE

Description

Integer codes are returned instead of a factor. Intervals closed on left and open on right.

Usage

cut_numeric_leftclosed(x, breaks)

Arguments

x, breaks

same as cut.

Value

An integer vector of level codes. As with cut, values which fall outside the range of breaks are coded as NA (as are NaN and NA values).

See Also

cut

Examples

x <- 1:10
y <- cut_numeric_leftclosed(x, breaks = c(0, 2, 7))
cbind(x, y)

z <- cut_numeric_leftclosed(x, breaks = c(1, 2, 7, Inf))
cbind(x, z)


jgabry/RHhelpers documentation built on Feb. 22, 2024, 12:56 p.m.