cut(x, ...) cut.default(x, breaks, labels=<<see below>>, include.lowest=F, factor.result=F, left.include=F)
bdVector
.
Missing values (
NA
s) are allowed.
x
should be cut. If a
vector of breakpoints is given, the category will have
length(breaks)-1
groups, corresponding to data in the intervals between
successive values in
breaks
(
breaks
must be sorted).
left.include
is
TRUE
.
TRUE
, then make the lowest bin include its lower endpoint,
otherwise (the default) make the lowest bin act like the others,
which include the upper endpoint but not the lower. (If
left.include
is
TRUE
, then
include.lowest
should really be called
include.highest
,
because it makes the highest bin include its higher endpoint instead
of having the default behavior of having each bin include the lower
endpoint but not the higher.)
TRUE
, then call
as.factor
on the result before returning.
TRUE
, then make each bin include its left (lower) endpoint
instead of having each bin include its right (upper) endpoint.
Also reverses the meaning of
include.lowest
. The default is
TRUE
for
timeDate
related classes such as
positionsCalendar
and
timeSpan
.
bdVector
as long as
x
telling which group each point in
x
belongs to, along with
an attribute,
levels
, which is a
vector of character names for each group.
If
left.include
is
FALSE
(the default), then
data less than or equal to the first breakpoint or greater than the
last breakpoint are returned as
NA
. Each group consists of data
greater than one breakpoint and less than or equal to the next breakpoint.
(However, if
include.lowest
is
TRUE
, the bottommost group also
includes data equal to the lowest breakpoint.)
If
left.include
is
TRUE
, then
data less than the first breakpoint or greater or equal to the
last breakpoint are returned as
NA
. Each group consists of data
greater or equal to one breakpoint and less than the next breakpoint.
(However, if
include.lowest
is
TRUE
, the uppermost group also
includes data equal to the highest breakpoint.) In either case,
missing values in
x
create missing values in the result.
The
cut
function is generic.
x <- 1:10 cut(x, 3) # cut into 3 groups cut(x, c(0,5,11)) # cut based on given breakpoints cut(x, pretty(x)) # approx 5 "pretty" intervals cut(x, c(1,5,10), left.include=T, inc=T) # cut using left intervals