colIds: Column and row summary function

Description Usage Arguments Value See Also Examples

Description

Summarizes the columns or rows of a rectangular object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## 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)
colMaxs(x)
colMedians(x)
colMins(x)
colRanges(x)
rowIds(x)
rowMaxs(x)
rowMins(x)
rowRanges(x)

Example output

[1] "col 1" "col 2" "col 3" "col 4" "col 5"
    col 1     col 2     col 3     col 4     col 5 
0.9092974 0.9893582 0.4121185 0.9906074 0.9129453 
     col 1      col 2      col 3      col 4      col 5 
 0.4912955  0.1887856 -0.5402970  0.5352274 -0.3005550 
     col 1      col 2      col 3      col 4      col 5 
-0.7568025 -0.9589243 -0.9999902 -0.2879033 -0.9613975 
          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
[1] "a" "b" "c" "d"
        a         b         c         d 
0.8414710 0.9906074 0.6569866 0.9893582 
         a          b          c          d 
-0.9613975 -0.7509872 -0.9999902 -0.7568025 
              a          b          c          d
[1,] -0.9613975 -0.7509872 -0.9999902 -0.7568025
[2,]  0.8414710  0.9906074  0.6569866  0.9893582

splus2R documentation built on Jan. 30, 2021, 9:05 a.m.