View source: R/format_invalue.R
| finputk | R Documentation |
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)'.
finputk(..., invalue_name, sep = "|", na_as_string = FALSE)
... |
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)'. |
The output type is determined by the stored invalue's 'target_type' (numeric / integer → numeric, character → character, logical → logical).
A vector whose type depends on the invalue's 'target_type'.
[finput()], [finputn()], [finputc()], [fputk()]
# 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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.