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.
manage_helper_col(
data,
arg,
default,
add_col = TRUE,
var_arg = deprecated(),
affix = deprecated()
)data, possibly with the helper column added.
The mapper's input data frame.
The mapper argument named like the helper column.
The default of that argument. Leave it out if the argument
has none, like items_averaged: data is then returned unchanged if the
argument is missing, and the test function reports that.
Logical. If data has no such column, should one be added
from arg? Default is TRUE.