EVOLUTION-MANAGER
Edit File: tabulate.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: Tabulation for Vectors</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 tabulate {base}"><tr><td>tabulate {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Tabulation for Vectors</h2> <h3>Description</h3> <p><code>tabulate</code> takes the integer-valued vector <code>bin</code> and counts the number of times each integer occurs in it. </p> <h3>Usage</h3> <pre> tabulate(bin, nbins = max(1, bin, na.rm = TRUE)) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>bin</code></td> <td> <p>a numeric vector (of positive integers), or a factor. <a href="LongVectors.html">Long vectors</a> are supported.</p> </td></tr> <tr valign="top"><td><code>nbins</code></td> <td> <p>the number of bins to be used.</p> </td></tr> </table> <h3>Details</h3> <p><code>tabulate</code> is the workhorse for the <code><a href="table.html">table</a></code> function. </p> <p>If <code>bin</code> is a factor, its internal integer representation is tabulated. </p> <p>If the elements of <code>bin</code> are numeric but not integers, they are truncated by <code><a href="integer.html">as.integer</a></code>. </p> <h3>Value</h3> <p>An integer valued <code><a href="integer.html">integer</a></code> or <code><a href="double.html">double</a></code> vector (without names). There is a bin for each of the values <code>1, ..., nbins</code>; values outside that range and <code>NA</code>s are (silently) ignored. </p> <p>On 64-bit platforms <code>bin</code> can have <i>2^31</i> or more elements (i.e., <code>length(bin) > .Machine$integer.max</code>), and hence a count could exceed the maximum integer. For this reason, the return value is of type double for such long <code>bin</code> vectors. </p> <h3>See Also</h3> <p><code><a href="table.html">table</a></code>, <code><a href="factor.html">factor</a></code>. </p> <h3>Examples</h3> <pre> tabulate(c(2,3,5)) tabulate(c(2,3,3,5), nbins = 10) tabulate(c(-2,0,2,3,3,5)) # -2 and 0 are ignored tabulate(c(-2,0,2,3,3,5), nbins = 3) tabulate(factor(letters[1:10])) </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>