absorb_key_args: Rename key columns according to the key arguments

View source: R/function-factory-helpers.R

absorb_key_argsR Documentation

Rename key columns according to the key arguments

Description

[Superseded]

absorb_key_args() is superseded by function_map(), whose mappers rename key columns themselves.

Call it in a handwritten mapper. If a key argument such as x names a column of data, it renames that column to the key argument's name, so that the rest of the mapper finds it.

Usage

absorb_key_args(data, reported, key_cols_call = NULL)

Arguments

data

Data frame passed to the mapper.

reported

String. Names of the key arguments.

key_cols_call

Optionally, a named character vector that maps key argument names to the columns of data that they refer to, such as c(x = "mean"). By default, it is read from the key arguments of the calling mapper.

Value

data, possibly with columns renamed. Reassign the result to data.

Examples

df <- tibble::tibble(mean = c(5.19, 4.56), n = c(28, 30))
absorb_key_args(df, c("x", "n"), key_cols_call = c(x = "mean"))

scrutiny documentation built on Nov. 11, 2026, 1:09 a.m.