DelayedMatrix-stats {DelayedArray} | R Documentation

## DelayedMatrix row/col summarization

### Description

Only a small number of row/col summarization methods are provided by the DelayedArray package.

See the DelayedMatrixStats package for an extensive set of row/col summarization methods.

### Usage

    ## S4 method for signature 'DelayedMatrix'
    rowSums(x, na.rm=FALSE, dims=1)
    ## S4 method for signature 'DelayedMatrix'
    colSums(x, na.rm=FALSE, dims=1)

    ## S4 method for signature 'DelayedMatrix'
    rowMeans(x, na.rm=FALSE, dims=1)
    ## S4 method for signature 'DelayedMatrix'
    colMeans(x, na.rm=FALSE, dims=1)

    ## S4 method for signature 'DelayedMatrix'
    rowMaxs(x, rows=NULL, cols=NULL, na.rm=FALSE, dim.=dim(x))
    ## S4 method for signature 'DelayedMatrix'
    colMaxs(x, rows=NULL, cols=NULL, na.rm=FALSE, dim.=dim(x))

    ## S4 method for signature 'DelayedMatrix'
    rowMins(x, rows=NULL, cols=NULL, na.rm=FALSE, dim.=dim(x))
    ## S4 method for signature 'DelayedMatrix'
    colMins(x, rows=NULL, cols=NULL, na.rm=FALSE, dim.=dim(x))

    ## S4 method for signature 'DelayedMatrix'
    rowRanges(x, rows=NULL, cols=NULL, na.rm=FALSE, dim.=dim(x))
    ## S4 method for signature 'DelayedMatrix'
    colRanges(x, rows=NULL, cols=NULL, na.rm=FALSE, dim.=dim(x))

### Arguments

`x` | A DelayedMatrix object.
`na.rm` | Should missing values (including `NaN`) be omitted from the calculations?
`dims, rows, cols, dim.` | These arguments are not supported and should not be used.

### Details

All these operations are block-processed.

### See Also

- The DelayedMatrixStats package for more row/col summarization methods for DelayedMatrix objects.

- `rowSums` in the base package and `rowMaxs` in the matrixStats package for row/col summarization of an ordinary matrix.

- DelayedMatrix-utils for other common operations on DelayedMatrix objects.

- DelayedMatrix objects.

- matrix objects in base R.

### Examples

    library(HDF5Array)
    toy_h5 <- system.file("extdata", "toy.h5", package="HDF5Array")
    h5ls(toy_h5)

    M1 <- HDF5Array(toy_h5, "M1")
    M2 <- HDF5Array(toy_h5, "M2")

    M12 <- rbind(M1, t(M2))        # delayed

    ## All these operations are block-processed.

    rowSums(M12)
    colSums(M12)

    rowMeans(M12)
    colMeans(M12)

    rmaxs <- rowMaxs(M12)
    cmaxs <- colMaxs(M12)

    rmins <- rowMins(M12)
    cmins <- colMins(M12)

    rranges <- rowRanges(M12)
    cranges <- colRanges(M12)

    ## Sanity checks:
    m12 <- rbind(as.matrix(M1), t(as.matrix(M2)))
    stopifnot(identical(rowSums(M12), rowSums(m12)))
    stopifnot(identical(colSums(M12), colSums(m12)))
    stopifnot(identical(rowMeans(M12), rowMeans(m12)))
    stopifnot(identical(colMeans(M12), colMeans(m12)))
    stopifnot(identical(rmaxs, rowMaxs(m12)))
    stopifnot(identical(cmaxs, colMaxs(m12)))
    stopifnot(identical(rmins, rowMins(m12)))
    stopifnot(identical(cmins, colMins(m12)))
    stopifnot(identical(rranges, cbind(rmins, rmaxs, deparse.level=0)))
    stopifnot(identical(cranges, cbind(cmins, cmaxs, deparse.level=0)))

[Package DelayedArray version 0.13.12 Index]