| %map% | R Documentation |
Performs case-insensitive matching between elements in x and entries in table,
returning a named character vector: names are the matched entries from table,
values are the original elements from x.
Unmatched values are ignored (not included in the result).
x %map% table
x |
Character vector of input strings. |
table |
Character vector to match against. |
A named character vector. Names are from matched table values, values are from x.
If no matches are found, returns a zero-length named character vector.
# Basic matching (case-insensitive)
c("tp53", "brca1", "egfr") %map% c("TP53", "EGFR", "MYC")
# returns: Named vector: TP53 = "tp53", EGFR = "egfr"
# Values not in table are dropped
c("akt1", "tp53") %map% c("TP53", "EGFR")
# returns: TP53 = "tp53"
# All unmatched values returns: empty result
c("none1", "none2") %map% c("TP53", "EGFR")
# returns: character(0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.