Skip to contents

fillet() calls chop() with extend = FALSE and drop = FALSE. This ensures that you get only the breaks and labels you ask for. When programming, consider using fillet() instead of chop().

Usage

fillet(
  x,
  breaks,
  labels = lbl_intervals(),
  left = TRUE,
  close_end = TRUE,
  raw = NULL
)

Arguments

x

A vector.

breaks

A numeric vector of cut-points or a function to create cut-points from x.

labels

A character vector of labels or a function to create labels.

left

Logical. Left-closed or right-closed breaks?

close_end

Logical. Close last break at right? (If left is FALSE, close first break at left?)

raw

Logical. Use raw values in labels?

Value

fillet() returns a factor of the same length as x, representing the intervals containing the value of x.

See also

Examples

fillet(1:10, c(2, 5, 8))
#>  [1] <NA>   [2, 5) [2, 5) [2, 5) [5, 8] [5, 8] [5, 8] [5, 8] <NA>   <NA>  
#> Levels: [2, 5) [5, 8]