powered by
chop_fn() is a convenience wrapper: chop_fn(x, foo, ...) is the same as chop(x, foo(x, ...)).
chop_fn()
chop_fn(x, foo, ...)
chop(x, foo(x, ...))
chop_fn( x, fn, ..., extend = NULL, left = TRUE, close_end = TRUE, raw = NULL, drop = TRUE )brk_fn(fn, ...)tab_fn( x, fn, ..., extend = NULL, left = TRUE, close_end = TRUE, raw = NULL, drop = TRUE )
brk_fn(fn, ...)
tab_fn( x, fn, ..., extend = NULL, left = TRUE, close_end = TRUE, raw = NULL, drop = TRUE )
chop_* functions return a factor of the same length as x.
chop_*
factor
x
brk_* functions return a function to create breaks.
brk_*
function
breaks
tab_* functions return a contingency table().
tab_*
table()
A vector.
A function which returns a numeric vector of breaks.
Further arguments to fn
fn
Logical. If TRUE, always extend breaks to +/-Inf. If NULL, extend breaks to min(x) and/or max(x) only if necessary. If NULL, never extend.
TRUE
+/-Inf
NULL
min(x)
max(x)
Logical. Left-closed or right-closed breaks?
Logical. Close last break at right? (If left is FALSE, close first break at left?)
left
FALSE
Logical. Use raw values in labels?
Logical. Drop unused levels from the result?
Other chopping functions: chop_equally(), chop_evenly(), chop_mean_sd(), chop_n(), chop_proportions(), chop_quantiles(), chop_width(), chop(), fillet()
chop_equally()
chop_evenly()
chop_mean_sd()
chop_n()
chop_proportions()
chop_quantiles()
chop_width()
chop()
fillet()
if (requireNamespace("scales")) { chop_fn(rlnorm(10), scales::breaks_log(5)) # same as # x <- rlnorm(10) # chop(x, scales::breaks_log(5)(x)) }
Run the code above in your browser using DataLab