emoji_decompose() reports, for each glyph, what it depicts of a person
and how it is built: the emoji with its skin tones taken out, its
gender-neutral form, its tones, the gender and hair it shows, and the
components it is joined from. It describes glyphs, never the people who
write them; see Glyphs, not people in tidyEmoji. It is what
emoji_skin_tone(), emoji_gender() and emoji_retone() read.
Arguments
- x
A character vector of glyphs.
- long
If
TRUE, return one row per component instead, the wayemoji_emotion()does:emoji,position,component,role("person","object","gender_sign","hair","tone"or"other") andcomponent_name.
Value
With long = FALSE, a tibble with one row per element of x:
emoji (as given), name, base, neutral, tone, tones,
n_tones (distinct tones), gender, hair ("red", "curly",
"white" or "bald", NA otherwise), n_parts (the components a
zero-width joiner joins, 1 for a glyph with no joiner), parts (those
components without their tones, separated by "|") and modifiable
(whether the base takes a tone). NA input gives a row of NA.
Details
Each glyph is canonicalised first, so the bare heart U+2764 and the
qualified U+2764 U+FE0F decompose alike, and read from a table the
package builds once per session over the catalogue; a glyph the catalogue
does not list, such as a face followed by a swatch it cannot take, is
worked out on the fly.
Tone is
"default"for a glyph that takes a tone and has none,"light","medium_light","medium","medium_dark"or"dark"for one tone however many people carry it, and"mixed"for two or more, as on a couple with two tones. It isNAonly where the glyph cannot take a tone.toneslists every tone in reading order.Gender is the one the glyph is drawn with:
"female"or"male"from the female and male signsU+2640andU+2642or a gendered person (woman, man, girl, boy, old woman, old man), and from a list of twelve emoji whose gender lives in one code point (prince and princess, Santa and Mrs. Claus, the two dancers, the two pregnant people, men and women holding hands, the woman with headscarf, and breast-feeding, which the list follows emojibase in calling female);"mixed"for a multi-person emoji with both, a derivation of this package's own;"neutral"for the gender-neutral form, which platforms draw differently;NAwhere no gender is depicted.Neutral is the gender-neutral form the catalogue has, so woman running gives person running and woman technologist gives technologist;
NAwhere there is none.Base is the glyph with every tone taken out, in the catalogue's spelling. For a two-person emoji written as one code point untoned, a kiss or a handshake, the toned spellings are joined sequences and the base is the single code point.
See also
emoji_skin_tone(), emoji_gender() and emoji_retone(),
which apply it to a text column; emoji_properties() for what the
catalogue records.
Examples
couple <- "\U0001f469\U0001f3fb\u200d\u2764\ufe0f\u200d\U0001f468\U0001f3ff"
emoji_decompose(c("\U0001f44d\U0001f3fd", couple, "\U0001f3c3\u200d\u2640\ufe0f"))
#> # A tibble: 3 Γ 12
#> emoji name base neutral tone tones n_tones gender hair n_parts parts
#> <chr> <chr> <chr> <chr> <chr> <chr> <int> <chr> <chr> <int> <chr>
#> 1 ππ½ thumbs up:β¦ π NA mediβ¦ mediβ¦ 1 NA NA 1 π
#> 2 π©π»ββ€οΈβπ¨πΏ couple witβ¦ π©ββ€οΈβπ¨ π mixed lighβ¦ 2 mixed NA 3 π©|β€οΈ|β¦
#> 3 πββοΈ woman runnβ¦ πββοΈ π defaβ¦ defaβ¦ 0 female NA 2 π|βοΈ
#> # βΉ 1 more variable: modifiable <lgl>
emoji_decompose(couple, long = TRUE)
#> # A tibble: 5 Γ 5
#> emoji position component role component_name
#> <chr> <int> <chr> <chr> <chr>
#> 1 π©π»ββ€οΈβπ¨πΏ 1 π© person woman
#> 2 π©π»ββ€οΈβπ¨πΏ 2 π» tone light skin tone
#> 3 π©π»ββ€οΈβπ¨πΏ 3 β€οΈ object red heart
#> 4 π©π»ββ€οΈβπ¨πΏ 4 π¨ person man
#> 5 π©π»ββ€οΈβπ¨πΏ 5 πΏ tone dark skin tone