blockids | R Documentation |
Get the block or run number associated with each scan/timepoint in the dataset. Block indices are used to:
Track which scans belong to which runs
Split data by experimental blocks
Align events with their corresponding runs
Apply run-specific processing
blockids(x)
x |
The object containing block information (typically a sampling_frame or dataset) |
A numeric vector where:
Each element is the block/run ID for that scan
IDs are sequential integers starting from 1
Length matches the total number of scans
blocklens()
, split_by_block()
, sampling_frame()
Other block_operations:
blocklens()
,
split_by_block()
# Create a sampling frame with multiple runs
sframe <- sampling_frame(
blocklens = c(50, 75, 50), # Different length runs
TR = 2
)
# Get block IDs for all scans
block_ids <- blockids(sframe)
# Returns: c(1,1,...,1, 2,2,...,2, 3,3,...,3)
# 50 ones, 75 twos, 50 threes
# Create a matrix dataset
X <- matrix(rnorm(175 * 10), 175, 10) # 175 timepoints (50+75+50), 10 voxels
dset <- matrix_dataset(
X,
TR = 2,
run_length = c(50, 75, 50)
)
# Get block IDs from dataset
dataset_blocks <- blockids(dset)
# Use block IDs to split data by run
run_data <- split(1:nrow(X), dataset_blocks)
# Returns list with indices for each run
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.