Column-wise summary statistics with grouping variables | R Documentation |
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.
Quantile, colQuantile, rowQuantile
x <- matrix(runif(100 * 5), 100, 5)
id <- sample(1:3, 100, TRUE)
all.equal( colGroup(x, id), rowsum(x, id) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.