seriesIter {neuroim} | R Documentation |
seriesIter
Description
Construct a series iterator
Usage
seriesIter(x)
## S4 method for signature 'SparseBrainVector'
seriesIter(x)
## S4 method for signature 'BrainVector'
seriesIter(x)
Arguments
x |
the object to be iterated over. This is typically an instance of class |
Value
an iter
object from the iterators
package.
Methods (by class)
-
SparseBrainVector
: get a seriesIter for aSparseBrainVector
instance -
BrainVector
: get a series iterator for aBrainVector
instance
Examples
## create a BrainVector with 10X10X10X10, where the last dimension is
## by convention the fourth dimension.
bvec <- BrainVector(array(rnorm(10*10*10*10), rep(10,4)), BrainSpace(rep(10,4), c(1,1,1)))
iter <- seriesIter(bvec)
## compute mean of each series
library(foreach)
library(iterators)
foreach(i=iter, .combine=c) %do% { mean(i) }
iter <- seriesIter(bvec)
## combine all series into a matrix
foreach(i=iter, .combine=rbind) %do% { i }
## scale all series, add as columns in matrix.
foreach(i=seriesIter(bvec), .combine=cbind) %do% { scale(i) }
[Package neuroim version 0.0.6 Index]