data_chunks.fmri_mem_dataset | R Documentation |
This function creates data chunks for fmri_mem_dataset objects. It allows for the retrieval of run-wise or sequence-wise data chunks, as well as arbitrary chunks.
## S3 method for class 'fmri_mem_dataset'
data_chunks(x, nchunks = 1, runwise = FALSE, ...)
x |
An object of class 'fmri_mem_dataset'. |
nchunks |
The number of data chunks to create. Default is 1. |
runwise |
If TRUE, the data chunks are created run-wise. Default is FALSE. |
... |
Additional arguments. |
A list of data chunks, with each chunk containing the data, voxel indices, row indices, and chunk number.
# Create an fmri_mem_dataset
# ... (see example for fmri_mem_dataset)
# Create an iterator with 5 chunks
iter <- data_chunks(dset, nchunks=5)
`%do%` <- foreach::`%do%`
y <- foreach::foreach(chunk = iter) %do% { colMeans(chunk$data) }
length(y) == 5
# Create an iterator with 100 chunks
iter <- data_chunks(dset, nchunks=100)
y <- foreach::foreach(chunk = iter) %do% { colMeans(chunk$data) }
length(y) == 100
# Create a "runwise" iterator
iter <- data_chunks(dset, runwise=TRUE)
y <- foreach::foreach(chunk = iter) %do% { colMeans(chunk$data) }
length(y) == 2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.