finputk: Apply Invalue Using a Composite Label

View source: R/format_invalue.R

finputkR Documentation

Apply Invalue Using a Composite Label

Description

Convenience wrapper around an INVALUE lookup that pastes multiple vectors together into a composite label before reverse lookup. Mirrors [fputk()] on the invalue side, for INVALUE formats built with composite labels such as 'fmap(paste(col1, col2, sep = "|"), codes)'.

Usage

finputk(..., invalue_name, sep = "|", na_as_string = FALSE)

Arguments

...

Vectors to paste together into a composite label. All vectors are recycled to a common length by [paste()].

invalue_name

Character. Name of a registered INVALUE format.

sep

Separator inserted between the pasted components (default '"|"').

na_as_string

If 'FALSE' (default), an 'NA' in any component propagates to the composite label (restored to 'NA_character_' after the [paste()] step) so the invalue's 'missing_value' applies. If 'TRUE', the literal string '"NA"' produced by [paste()] is kept, which is useful when the invalue was built with composite labels via 'fmap(paste(..., sep = "|"), values)'.

Details

The output type is determined by the stored invalue's 'target_type' (numeric / integer → numeric, character → character, logical → logical).

Value

A vector whose type depends on the invalue's 'target_type'.

See Also

[finput()], [finputn()], [finputc()], [fputk()]

Examples

# Build an INVALUE keyed on two columns via paste()
finput(
  fmap(paste(c("A", "A", "B"), c(1, 2, 1), sep = "|"), c(10, 20, 30)),
  name = "ab_inv"
)

finputk(c("A", "A", "B"), c(1, 2, 1), invalue_name = "ab_inv")
# -> 10 20 30

fclear()


ksformat documentation built on May 21, 2026, 9:07 a.m.