Column-wise summary statistics with grouping variables
Column-wise summary statistics with grouping variables.
colGroup(x,ina,method="sum",names=TRUE, std = FALSE)
x |
A matrix with data. |
ina |
A numerical vector specifying the groups. If you have numerical values, do not put zeros, but 1, 2, 3 and so on. The numbers must be consecutive, like 1,2,3,.. Do not put 1, 3, 4 as this will cause C++ to crash. |
method |
One of the: "sum", "min", "max", "median", "var". |
names |
Set the name of the result vector with the unique numbers of group variable. |
std |
A boolean variable specyfying whether you want the variances (FALSE) or the standard deviations (TRUE) of each column. This is taken into account only when method = "var". |
Column wise of grouping variables. You can also include diagonal to the check.
Manos Papadakis
R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.
x <- matrix(runif(100 * 5), 100, 5) group <- sample(1:3, 100, TRUE) all.equal( colGroup(x, group), rowsum(x, group) )
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.