
tabulate
takes the integer-valued vector bin
and counts
the number of times each integer occurs in it.
tabulate(bin, nbins = max(1, bin, na.rm = TRUE))
tabulate
is the workhorse for the table
function. If bin
is a factor, its internal integer representation
is tabulated.
If the elements of bin
are numeric but not integers,
they are truncated by as.integer
.
table
, factor
.
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]))
Run the code above in your browser using DataLab