Extract an ordered list of 1D vectors.
Source:R/all_generic.R
, R/neurovec.R
, R/neurovecseq.R
, and 2 more
vectors-methods.Rd
This function extracts an ordered list of 1D vectors from an object that supplies vector data.
The subset
argument specifies the subset of vectors to extract, and can be a vector
of indices or a logical vector. The return value is a list containing the extracted vectors
in the same order as the specified indices.
Usage
vectors(x, subset, ...)
# S4 method for class 'NeuroVec,missing'
vectors(x)
# S4 method for class 'DenseNeuroVec,missing'
vectors(x)
# S4 method for class 'NeuroVec,numeric'
vectors(x, subset)
# S4 method for class 'NeuroVec,logical'
vectors(x, subset)
# S4 method for class 'NeuroVecSeq,missing'
vectors(x)
# S4 method for class 'NeuroVecSeq,numeric'
vectors(x, subset)
# S4 method for class 'NeuroVecSeq,logical'
vectors(x, subset)
# S4 method for class 'ROIVec,missing'
vectors(x)
# S4 method for class 'matrix,missing'
vectors(x)
# S4 method for class 'ROIVec,integer'
vectors(x, subset)
# S4 method for class 'matrix,integer'
vectors(x, subset)
# S4 method for class 'matrix,numeric'
vectors(x, subset)
# S4 method for class 'ROIVec,numeric'
vectors(x, subset)
# S4 method for class 'ROIVec,logical'
vectors(x, subset)
# S4 method for class 'SparseNeuroVec,missing'
vectors(x, nonzero = FALSE)
Examples
file_name <- system.file("extdata", "global_mask_v4.nii", package="neuroim2")
vec <- read_vec(file_name)
v <- vectors(vec)
mean(v[[1]])
#> [1] 0