vectors-methods: Extract an ordered list of 1D vectors.

vectorsR Documentation

Extract an ordered list of 1D vectors.

Description

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 signature 'NeuroVec,missing'
vectors(x)

## S4 method for signature 'DenseNeuroVec,missing'
vectors(x)

## S4 method for signature 'NeuroVec,numeric'
vectors(x, subset)

## S4 method for signature 'NeuroVec,logical'
vectors(x, subset)

## S4 method for signature 'NeuroVecSeq,missing'
vectors(x)

## S4 method for signature 'NeuroVecSeq,numeric'
vectors(x, subset)

## S4 method for signature 'NeuroVecSeq,logical'
vectors(x, subset)

## S4 method for signature 'ROIVec,missing'
vectors(x)

## S4 method for signature 'matrix,missing'
vectors(x)

## S4 method for signature 'ROIVec,integer'
vectors(x, subset)

## S4 method for signature 'matrix,integer'
vectors(x, subset)

## S4 method for signature 'matrix,numeric'
vectors(x, subset)

## S4 method for signature 'ROIVec,numeric'
vectors(x, subset)

## S4 method for signature 'ROIVec,logical'
vectors(x, subset)

## S4 method for signature 'SparseNeuroVec,missing'
vectors(x, nonzero = FALSE)

Arguments

x

the object that supplies the vector data.

subset

the subset of vectors to extract.

...

additional arguments to be passed to methods.

nonzero

only include nonzero vectors in output list

Value

A list containing the extracted vectors from x in the same order as subset.

A deflist object where each element is a function that returns the time series for a voxel. The length of the deflist equals the total number of voxels.

Examples


file_name <- system.file("extdata", "global_mask_v4.nii", package="neuroim2")
vec <- read_vec(file_name)
v <- vectors(vec)
mean(v[[1]])

bbuchsbaum/neuroim2 documentation built on Feb. 26, 2025, 3:49 p.m.