Summarizes the columns or rows of a rectangular object.

colIds(x, do.NULL=TRUE, prefix="col")
colMaxs(x, na.rm = FALSE, dims = 1, n = NULL)
colMedians(x, na.rm=FALSE)
colMins(x, na.rm = FALSE, dims = 1, n = NULL)
colRanges(x, na.rm = FALSE, dims = 1, n = NULL)
colVars(x, na.rm=FALSE, dims = 1, unbiased = TRUE,
        SumSquares = FALSE, weights = NULL, freq = NULL, n = NULL)
rowIds(x, do.NULL=TRUE, prefix="row")
rowMaxs(x, na.rm = FALSE, dims = 1, n = NULL)
rowMins(x, na.rm = FALSE, dims = 1, n = NULL)
rowRanges(x, na.rm = FALSE, dims = 1, n = NULL)

Arguments

x

rectangular input object such as a matrix or data.frame.

dims

if x has dimension higher than 2, dims determines what dimensions are summarized.

do.NULL

logical for rowIds or colIds.

n

number of rows; treat x as a matrix with n rows.

na.rm

logical, NA values are removed if TRUE.

prefix

character string preface for column IDs returned by rowIds or colIds.

unbiased

logical, unbiased variance estimates returned if TRUE.

SumSquares

logical, sums of squares are returned if TRUE.

weights, freq

unsupported, here for backwards compatibility.

Value

corresponding summary by row or by column.

See also

See 'aggregate' package for alternative definitions of colStdevs, colVars, rowStdevs and rowVars functions.

Examples

## create a matrix, add dimensions, and obtain
## various summaries
x <- matrix(sin(1:20), nrow=4)
dimnames(x) <- list(c("a","b","c","d"), paste("col", 1:5))
colIds(x)
#> [1] "col 1" "col 2" "col 3" "col 4" "col 5"
colMaxs(x)
#>     col 1     col 2     col 3     col 4     col 5 
#> 0.9092974 0.9893582 0.4121185 0.9906074 0.9129453 
colMedians(x)
#>      col 1      col 2      col 3      col 4      col 5 
#>  0.4912955  0.1887856 -0.5402970  0.5352274 -0.3005550 
colMins(x)
#>      col 1      col 2      col 3      col 4      col 5 
#> -0.7568025 -0.9589243 -0.9999902 -0.2879033 -0.9613975 
colRanges(x)
#>           col 1      col 2      col 3      col 4      col 5
#> [1,] -0.7568025 -0.9589243 -0.9999902 -0.2879033 -0.9613975
#> [2,]  0.9092974  0.9893582  0.4121185  0.9906074  0.9129453
rowIds(x)
#> [1] "a" "b" "c" "d"
rowMaxs(x)
#>         a         b         c         d 
#> 0.8414710 0.9906074 0.6569866 0.9893582 
rowMins(x)
#>          a          b          c          d 
#> -0.9613975 -0.7509872 -0.9999902 -0.7568025 
rowRanges(x)
#>               a          b          c          d
#> [1,] -0.9613975 -0.7509872 -0.9999902 -0.7568025
#> [2,]  0.8414710  0.9906074  0.6569866  0.9893582