Wrapper for running multi-column mutator methods
multi_mutator_(
data,
mutate_fn,
check_fn,
cols = NULL,
suffix = "_mutated",
overwrite = FALSE,
force_df = TRUE,
allowed_types = c("numeric", "factor"),
allow_missing = FALSE,
min_dims = 1,
altered_col = NULL,
keep_original = TRUE,
origin_fn = NULL,
...
)The mutated data.frame (tibble).
data.frame or vector.
Mutator to apply.
Function with checks post-preparation of `data` and `col(s)`.
Should not return anything.
Columns to mutate values of. Must be specified when `data` is a data.frame.
Suffix to add to the names of the generated columns.
Use an empty string (i.e. "") to overwrite the original columns.
Whether to allow overwriting of existing columns. (Logical)
Whether to return a data.frame when `data` is a vector.
Allowed types of the `col(s)` columns. The type restrictions do not apply to
columns not mentioned in the `col(s)` argument.
Whether to allow missing values (NAs). (Logical)
Minimum number of dimensions (cols) after preparations. When `data` is a vector
setting `min_dims` to 2 will use both the index and the values as columns.
Additional column that is mutated but is not
mentioned in `cols`.
Whether to keep the original columns. (Logical)
Some columns may have been overwritten, in which case only the newest versions are returned.
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 `mutate_fn`.