fcut | R Documentation |
Bins a numeric vector x
into bins specified by breaks
.
Values outside the range of breaks
will be placed in the lowest or highest bin.
Set labels = FALSE
to return integer codes only, and explicit_na = TRUE
for
maximal synergy with the "collapse" package.
Uses the logic of spatstat.utils::fastFindInterval()
for equi-length bins.
fcut(x, breaks, labels = NULL, right = TRUE, explicit_na = FALSE)
x |
A numeric vector. |
breaks |
A monotonically increasing numeric vector of breaks. |
labels |
A character vector of length |
right |
Right closed bins ( |
explicit_na |
If |
Binned version of x
. Either a factor, or integer codes.
x <- c(NA, 1:10)
fcut(x, breaks = c(3, 5, 7))
fcut(x, breaks = c(3, 5, 7), right = FALSE)
fcut(x, breaks = c(3, 5, 7), labels = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.