Wrapper for running rearranging methods
rearranger_(
data,
rearrange_fn,
check_fn,
cols = NULL,
allowed_types = c("numeric", "factor", "character"),
col = deprecated(),
overwrite = FALSE,
origin_fn = NULL,
...
)
The sorted data.frame
(tibble
) / vector
.
Optionally with (a) sorting factor(s) added.
When `data`
is a vector
and
no extra factors are returned by `rearrange_fn`
,
the output will be a vector
. Otherwise, a data.frame
.
data.frame
or vector
.
Rearrange function to apply.
Function with checks post-preparation of `data`
and `col(s)`
.
Should not return anything.
Column(s) to create sorting factor by.
When `NULL`
and `data`
is a data.frame
,
the row numbers are used.
Allowed types of the `col(s)`
columns. The type restrictions do not apply to
columns not mentioned in the `col(s)`
argument.
Column to create sorting factor by.
When `NULL`
and `data`
is a data.frame
,
the row numbers are used.
Whether to allow overwriting of existing columns. (Logical)
Function for finding the origin coordinates.
Input: Each column will be passed as a vector
in the order of `cols`
.
Output: A vector
with one scalar per dimension.
Can be created with create_origin_fn()
if you want to apply
the same function to each dimension.
E.g. `create_origin_fn(median)`
would find the median of each column.
Built-in functions are centroid()
,
most_centered()
,
and midrange()
Named arguments for the `rearrange_fn`
.