Tabulate a vector a whose values fall into a set of integers of maximum value nbins. This function does no argument checking so please ensure the maximum value of observations is not greater than nbins.

tab_bins(a, nbins)

Arguments

a

a set of observations

nbins

number of bins

Examples

nbin <- 10
a <- sample.int(n = nbin,size = 100,replace = TRUE)
tabulate(bin = a,nbins = nbin)
#>  [1] 12  8 11  8 10  9  9 12 13  8
tab_bins(a = a,nbins = nbin)
#>  [1] 12  8 11  8 10  9  9 12 13  8