View source: R/summarizeCols.R
summarizeCols | R Documentation |
summarizeCols
summarizes all columns of matrix (or data.frame).
In case of text-columns the sorted middle (~median) will be given, unless 'maxAbsLast', 'minAbsLast',
.. consider only last column of 'matr' : choose from all columns the line where (max of) last col is at min;
'medianComplete' or 'meanComplete' consideres only lines/rows where no NA occur (NA have influence other columns !)
summarizeCols(
matr,
meth = "median",
refCol = NULL,
nEqu = FALSE,
supl = NULL,
silent = FALSE,
debug = FALSE,
callFrom = NULL
)
matr |
data.frame matrix of data to be summarized by comlumn (may do different method for text and numeric comlumns) |
meth |
(character) summarization method, may be 'mean','aver','median','sd','CV', 'min','max','first','last','maxOfRef','minOfRef','maxAbsLast','minAbsLast',
'medianComplete' or 'meanComplete', 'n' (number of non- |
refCol |
(character or integr) column to be used as reference |
nEqu |
(logical) if |
supl |
(numeric) supplemental parameters for the various summarizing functions (eg used with |
silent |
(logical) suppress messages |
debug |
(logical) additional messages for debugging |
callFrom |
(character) allows easier tracking of messages produced |
The argument method
allows options that treat (summarize) all columns independently or to select one line (based on argument refCol
)
vector with summary for each column
colSums
; if data has subgroups to be used in a tapply
-way please see makeNRedMatr
t1 <- matrix(round(runif(30,1,9)),nc=3); rownames(t1) <- letters[c(1:5,3:4,6:4)]
summarizeCols(t1, me="median")
t(sapply(by(t1,rownames(t1), function(x) x), summarizeCols,me="maxAbsLast"))
t3 <- data.frame(ref=rep(11:15,3), tx=letters[1:15],
matrix(round(runif(30,-3,2),1), ncol=2), stringsAsFactors=FALSE)
by(t3,t3[,1], function(x) x)
by(t3,t3[,1], function(x) summarizeCols(x, me="maxAbsLast"))
t(sapply(by(t3, t3[,1], function(x) x), summarizeCols, me="maxAbsLast"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.