manage_helper_col() is superseded by the .cols_helper argument of
function_map().
A helper column is a column of a mapper's input that is not
itself tested but enters the test, such as items_averaged in
grim_map(). It can be given either as a column of data or as an
argument of the same name. manage_helper_col() checks that the two
don't disagree if both are given and, by default, adds the argument's
value to data as a column if data has none.
Mappers made by function_map() call it for every .cols_helper
argument. Call it yourself in a handwritten mapper, once per helper
column, and reassign the result to data.
Usage
manage_helper_col(
data,
arg,
default,
add_col = TRUE,
var_arg = deprecated(),
affix = deprecated()
)Arguments
- data
The mapper's input data frame.
- arg
The mapper argument named like the helper column.
- default
The default of that argument. Leave it out if the argument has none, like
items_averaged:datais then returned unchanged if the argument is missing, and the test function reports that.- add_col
Logical. If
datahas no such column, should one be added fromarg? Default isTRUE.- var_arg, affix
