EVOLUTION-MANAGER
Edit File: hash_emoji.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Emoji hash</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for hash_emoji {cli}"><tr><td>hash_emoji {cli}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Emoji hash</h2> <h3>Description</h3> <p>Emoji hash </p> <h3>Usage</h3> <pre> hash_emoji(x, size = 3) hash_raw_emoji(x, size = 3) hash_obj_emoji(x, size = 3, serialize_version = 2) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>Character vector. <code>NA</code> entries will have an <code>NA</code> hash.</p> </td></tr> <tr valign="top"><td><code>size</code></td> <td> <p>Number of emojis to use in a hash. Currently it has to be between 1 and 4.</p> </td></tr> <tr valign="top"><td><code>serialize_version</code></td> <td> <p>Workspace format version to use, see <code><a href="../../base/html/serialize.html">base::serialize()</a></code>.</p> </td></tr> </table> <h3>Details</h3> <p>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. </p> <h4>Number of possible hash values</h4> <p>cli uses 2280 possible emojis. This is the number of different hashes you can get for different values of <code>size</code>:</p> <table summary="Rd table"> <tr> <td style="text-align: right;"> <code>size</code> </td><td style="text-align: right;"> size of hash table space </td> </tr> <tr> <td style="text-align: right;"> 1 </td><td style="text-align: right;"> 2,280 </td> </tr> <tr> <td style="text-align: right;"> 2 </td><td style="text-align: right;"> 5,198,400 </td> </tr> <tr> <td style="text-align: right;"> 3 </td><td style="text-align: right;"> 11,852,352,000 </td> </tr> <tr> <td style="text-align: right;"> 4 </td><td style="text-align: right;"> 27,023,362,560,000 </td> </tr> <tr> <td style="text-align: right;"> </td> </tr> </table> <p><code>hash_raw_emoji()</code> calculates the emoji hash of the bytes of a raw vector. </p> <p><code>hash_obj_emoji()</code> calculates the emoji hash of an R object. The object is serialized into a binary vector first. </p> <h3>Value</h3> <p><code>hash_emoji()</code> returns a data frame with columns </p> <ul> <li> <p><code>hash</code>: the emoji hash, a string of the requested size. </p> </li> <li> <p><code>emojis</code>: list column with the emoji characters in character vectors. Note that an emoji might have multiple code points. </p> </li> <li> <p><code>text</code>: text representation of <code>hash</code>, comma separated. </p> </li> <li> <p><code>names</code>: list column with the text representations of <code>emojis</code>, in character vectors. </p> </li></ul> <p><code>hash_raw_emoji()</code> and <code>hash_obj_emoji()</code> return a list with entries: </p> <ul> <li> <p><code>hash</code>: the emoji hash, a string of requested size, </p> </li> <li> <p><code>emojis</code>: the individual emoji characters in a character vector, </p> </li> <li> <p><code>text</code>: text representation of <code>hash</code>, comma separated, </p> </li> <li> <p><code>names</code>: names of the emojis, in a character vector. </p> </li></ul> <h3>See Also</h3> <p>the emoji package for a comprehensive list of emojis </p> <p>Other hash functions: <code><a href="hash_animal.html">hash_animal</a>()</code>, <code><a href="hash_md5.html">hash_md5</a>()</code>, <code><a href="hash_sha256.html">hash_sha256</a>()</code> </p> <h3>Examples</h3> <pre> hash_emoji(c("foo", NA, "bar", ""))$text # if you increase `size`, the shorter hash is a prefix of the longer: hash_emoji("foobar", 1)$text hash_emoji("foobar", 2)$text hash_emoji("foobar", 3)$text hash_emoji("foobar", 4)$text </pre> <hr /><div style="text-align: center;">[Package <em>cli</em> version 3.4.1 <a href="00Index.html">Index</a>]</div> </body></html>