Learn R Programming

MESS (version 0.5.12)

colCumSum: Apply cumsum to each column of matrix

Description

Fast computation of apply(m, 2, cumsum)

Usage

colCumSum(m)

Value

A matrix the same size as m with the column-wise cumulative sums.

Arguments

m

A matrix

Author

Claus Ekstrom <claus@rprimer.dk>

Examples

Run this code
  # Generate a 100 by 10000 matrix
  x <- matrix(rnorm(100*10000), nrow=100)
  result <- colCumSum(x)

Run the code above in your browser using DataLab