tabulate(bin, nbins = max(bin), weights = NULL)
bdVector of bin numbers, between
1 and
nbins, inclusive.
A category is appropriate for
bin.
Missing values are not accepted.
max(bin).
bin.
bdVector's are not supported.
bdVector of length
nbins. The
ith element of the value
counts the number of
is that occurred in
bin.
weights is supplied, the
ith element of the value
is the sum of
weights for observations with
bin == i.
Takes a vector or
bdVector,
bin, and returns a vector or
bdVector of length
nbins. For each
element,
i, counts the number of
is that occurred in
bin.
Or, if
weights are supplied, returns the
or the sum of
weights corresponding to
is in
bin.
Missing values in
bin are omitted.
If
weights is supplied, then missing values in either
bin or
weights
cause the corresponding elements of both to be omitted.
tabulate(cut(lottery.payoff,10),10) x <- c(1:5, 5, 6, 6:8) tabulate(x) # Produces: # [1] 1 1 1 1 2 2 1 1 tabulate(x, 15) # Produces: # [1] 1 1 1 1 2 2 1 1 0 0 0 0 0 0 0 tabulate(x, 8, weights = 1:10) # [1] 1 2 3 4 11 15 9 10