chop_width {santoku} | R Documentation |
Chop into fixed-width intervals
Description
chop_width()
chops x
into intervals of fixed width
.
Usage
chop_width(x, width, start, ..., left = sign(width) > 0)
brk_width(width, start)
## Default S3 method:
brk_width(width, start)
tab_width(x, width, start, ..., left = sign(width) > 0)
Arguments
x |
A vector. |
width |
Width of intervals. |
start |
Starting point for intervals. By default the smallest
finite |
... |
Passed to |
left |
Logical. Left-closed or right-closed breaks? |
Details
If width
is negative, chop_width()
sets left = FALSE
and intervals will
go downwards from start
.
Value
chop_*
functions return a factor
of the same length as x
.
brk_*
functions return a function
to create breaks
.
tab_*
functions return a contingency table()
.
See Also
Other chopping functions:
chop()
,
chop_equally()
,
chop_evenly()
,
chop_fn()
,
chop_mean_sd()
,
chop_n()
,
chop_proportions()
,
chop_quantiles()
,
fillet()
Examples
chop_width(1:10, 2)
chop_width(1:10, 2, start = 0)
chop_width(1:9, -2)
chop(1:10, brk_width(2, 0))
tab_width(1:10, 2, start = 0)
[Package santoku version 1.0.0 Index]