tabulate
Count Entries in Bins

Description

Counts the number of occurrences of integers.

Usage

tabulate(bin, nbins = max(1L, bin, na.rm = TRUE))

Arguments

bin a vector of bin numbers between 1 and nbins, inclusive. bin can be a factor. If you specify bin as a factor, its internal integer representation is tabulated. Missing values, negative values, and zero are ignored.
nbins the maximum number of bins. This value must be at least as large as max(bin).

Details

tabulate takes a vector, bin, and returns a vector of length nbins. For each element i, tabulate counts the number of is that occur in bin.
Missing values in bin are omitted.
Value
returns a vector of length nbins. The ith element of the value counts the number of is that occur in bin.
See Also
hist, table
Examples
tabulate(c(1,4,5))
# [1] 1 0 0 1 1

tabulate(c(1,4,5,0,-2)) # -2 and 0 are ignored. # [1] 1 0 0 1 1

tabulate(c(1,4,5), nbins=8) # [1] 1 0 0 1 1 0 0 0

tabulate(c(1,4,5), nbins=3) # [1] 1 0 0

Package base version 6.1.4-13
Package Index