Skip to content
Prev 155283 / 398506 Next

Averaging 'blocks' of data

On Sun, Sep 7, 2008 at 12:32 PM, Steve Murray <smurray444 at hotmail.com> wrote:
what does the data look like? vector / matrix / list ?
some form of apply(), tapply(), mapply(), or lapply() would probably
do what you want
Here is a start:

# step 1. too much data: 10x10 matrix
m <- matrix(runif(100), ncol=10)

# step 2. reduce down to a 10x1 vector, averaging-by-row:
apply(m, 1, mean)

# step 3 profit.

Dylan