text_to_emoji() returns a copy of data with its text column rewritten so
that every :shortcode: token is replaced by the corresponding emoji glyph
(the inverse of emoji_to_text() with format = "shortcode"). Shortcodes
that do not match a known emoji are left unchanged.
Details
A shortcode token is a colon, one or more of A-Z, a-z, 0-9, _, +
or -, and a closing colon. Restricting the token this way means colons
used for other purposes – clock times, URLs, ratios, ordinary punctuation
– cannot swallow a following shortcode: "meet at 10:30 :wave:" still
emojizes the wave.
See also
emoji_to_text(); as_emoji() for the vector helper.
Examples
df <- data.frame(text = "hi :grinning: bye :waving_hand:")
text_to_emoji(df, text)
#> # A tibble: 1 × 1
#> text
#> <chr>
#> 1 hi 😀 bye 👋
# colons elsewhere in the text do not interfere
text_to_emoji(data.frame(text = "https://example.org at 10:30 :grinning:"),
text)
#> # A tibble: 1 × 1
#> text
#> <chr>
#> 1 https://example.org at 10:30 😀