blob: f9b61fa3df38a94775a42e2c327a8e0e1744d19e [file] [log] [blame]
<!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: Miscellaneous functions for Column operations</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="R.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/styles/github.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/languages/r.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</head><body>
<table width="100%" summary="page for column_misc_functions {SparkR}"><tr><td>column_misc_functions {SparkR}</td><td style="text-align: right;">R Documentation</td></tr></table>
<h2>Miscellaneous functions for Column operations</h2>
<h3>Description</h3>
<p>Miscellaneous functions defined for <code>Column</code>.
</p>
<h3>Usage</h3>
<pre>
crc32(x)
hash(x, ...)
md5(x)
sha1(x)
sha2(y, x)
## S4 method for signature 'Column'
crc32(x)
## S4 method for signature 'Column'
hash(x, ...)
## S4 method for signature 'Column'
md5(x)
## S4 method for signature 'Column'
sha1(x)
## S4 method for signature 'Column,numeric'
sha2(y, x)
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>x</code></td>
<td>
<p>Column to compute on. In <code>sha2</code>, it is one of 224, 256, 384, or 512.</p>
</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
<p>additional Columns.</p>
</td></tr>
<tr valign="top"><td><code>y</code></td>
<td>
<p>Column to compute on.</p>
</td></tr>
</table>
<h3>Details</h3>
<p><code>crc32</code>: Calculates the cyclic redundancy check value (CRC32) of a binary column
and returns the value as a bigint.
</p>
<p><code>hash</code>: Calculates the hash code of given columns, and returns the result
as an int column.
</p>
<p><code>md5</code>: Calculates the MD5 digest of a binary column and returns the value
as a 32 character hex string.
</p>
<p><code>sha1</code>: Calculates the SHA-1 digest of a binary column and returns the value
as a 40 character hex string.
</p>
<p><code>sha2</code>: Calculates the SHA-2 family of hash functions of a binary column and
returns the value as a hex string. The second argument <code>x</code> specifies the number
of bits, and is one of 224, 256, 384, or 512.
</p>
<h3>Note</h3>
<p>crc32 since 1.5.0
</p>
<p>hash since 2.0.0
</p>
<p>md5 since 1.5.0
</p>
<p>sha1 since 1.5.0
</p>
<p>sha2 since 1.5.0
</p>
<h3>Examples</h3>
<pre><code class="r">## Not run:
##D # Dataframe used throughout this doc
##D df &lt;- createDataFrame(cbind(model = rownames(mtcars), mtcars)[, 1:2])
##D tmp &lt;- mutate(df, v1 = crc32(df$model), v2 = hash(df$model),
##D v3 = hash(df$model, df$mpg), v4 = md5(df$model),
##D v5 = sha1(df$model), v6 = sha2(df$model, 256))
##D head(tmp)
## End(Not run)
</code></pre>
<hr /><div style="text-align: center;">[Package <em>SparkR</em> version 2.3.1 <a href="00Index.html">Index</a>]</div>
</body></html>