Bins a continuous variable into a categorical variable
binVar(
x,
bins = 4,
method = c("intervals", "proportions"),
labels = FALSE,
include.lowest = TRUE,
right = FALSE,
...
)
Continuous variable to be binnged
Number of groups in new variable
Method for generating "intervals" for fixed-width intervals and "proportions" for cut-points based on quantiles of the distribution.
An optional vector of labels to apply to the groups
Logical indicating whether a value equal to the lowest (if right=TRUE
) or highest (if right=FALSE
) should be included.
Logical indicating Whether the intervals should be closed on the right and open on the left (if TRUE
) or vice versa (if FALSE
). Open intervals are those that do not include the end-point of the range and closed intervals do.
Other arguments to be passed down to cut
Function adapted from binVariable
from the RcmdrMisc pacakge.
A factor