Column summary

DESCRIPTION:

Tabulate each column of a matrix

USAGE:

colTabulate(bin, nbins = max(bin), weights = NULL) 

REQUIRED ARGUMENTS:

bin
matrix of bin numbers, values between 1 and nbins, inclusive. Missing values are not accepted.
nbins
maximum number of bins, at least as large as max(bin).

OPTIONAL ARGUMENTS:

weights
if supplied, numeric vector with length equal to the number of rows in bin.

VALUE:

matrix with nbins rows and the same number of columns as bin. The [i,j] element of the value is the number of is that occured in bin[,j]. The result is equivalent to apply(bin, 2, tabulate, nbins=max(bin)), except that column names are ignored.

Or, if weights is supplied, the i,j element of the value is the sum of weights for observations with bin[,j] == i.

SEE ALSO:

, .

EXAMPLES:

colTabulate(cbind(rep(1:4, 4:1), rep(1:2, each=5)))