populate_slots: Populate variable/level slots from named values

View source: R/slot_helpers.R

populate_slotsR Documentation

Populate variable/level slots from named values

Description

Populate variable/level slots from named values

Usage

populate_slots(x, ..., max_vars = 12)

Arguments

x

A data frame to which slot columns will be added or updated.

...

Named vectors of levels. Each argument name becomes the value of a ⁠variable<n>⁠ column, and its values populate the corresponding ⁠level<n>⁠ column. Each vector must have length one or nrow(x).

max_vars

A nonnegative integer giving the maximum number of variable-level slot pairs.

Value

A data frame containing x with variable and level slot columns populated from the named values supplied through ....

Examples

factors <- data.frame(
  term_name = c("territory_limit", "territory_limit"),
  term_value = c(1.10, 0.95)
)

factors <- populate_slots(
  factors,
  territory = c("A", "B"),
  limit = "100/300",
  max_vars = 2
)

factors

ratingtables documentation built on Sept. 6, 2026, 1:06 a.m.