bin_integer: Convert integer vector into binned factor with integer cuts...

View source: R/factor.R

bin_integerR Documentation

Convert integer vector into binned factor with integer cuts and appropriately named levels

Description

Takes a numeric input vector, groups into bins based on the argument cuts, and outputs an ordered factor with appropriate names. Any NAs in the input are optionally grouped into an explicit NA level with name na_level

Usage

bin_integer(x, cuts, na_level = NULL, na_at_end = FALSE)

Arguments

x

Integer vector to be binned.

cuts

An integer vector giving bin cuts. Don't add -Inf or Inf end cuts as these are handled automatically.

na_level

A name for the explicit NA level (if any). If left as the default NULL then no explicit NA level will be formed.

na_at_end

Logical indicating whether to put any explicit NA level at the end of the levels. The default na_at_end = FALSE will put the level at the start.


jedwards24/edwards documentation built on Sept. 2, 2023, 8:16 a.m.