hash_emoji(x, size = 3)
Number of emojis to use in a hash. Currently it has to be between 1 and 4.
A data frame with columns
hash: the emoji hash, a string of the requested size.
emojis: list column with the emoji characters in character
vectors. Note that an emoji might have multiple code points.
text: text representation of
hash, comma separated.
names: list column with the text representations of
It uses the first 13 hexadecimal characters (out of the 32) of the MD5 hash of the input, and converts them into an emoji representation. It uses a manually selected subset of all emojis, that tend to be displayed correctly.
cli uses 2280 possible emojis. This is the number of
different hashes you can get for different values of
|size of hash table space|
the emoji package for a comprehensive list of emojis
hash_emoji(c("foo", NA, "bar", ""))$text #>  "sun behind cloud, raised back of hand: dark skin tone, children crossing" #>  NA #>  "man pilot: medium-light skin tone, flag: Afghanistan, keycap: *" #>  "teacup without handle, rhinoceros, flushed face" # if you increase `size`, the shorter hash is a prefix of the longer: hash_emoji("foobar", 1)$text #>  "fishing pole" hash_emoji("foobar", 2)$text #>  "fishing pole, money with wings" hash_emoji("foobar", 3)$text #>  "fishing pole, money with wings, eagle" hash_emoji("foobar", 4)$text #>  "fishing pole, money with wings, eagle, dog face"