Recursively walks a numeric, logical, or nested list structure and returns a single flat numeric vector. Internal helper; mirrors SPM25's spm_vec.

dcm_vec(X, ...)

Arguments

X

A numeric, logical, or list (possibly nested).

...

Additional structures to flatten and concatenate.

Value

A numeric vector.

See also

dcm_unvec for the inverse operation.

Examples

# A DCM parameter structure flattens in field order
P <- list(A = matrix(1:4, 2), C = c(5, 6))
dcm_vec(P)
#> [1] 1 2 3 4 5 6

# Nested lists are walked recursively
dcm_vec(list(a = 1, b = list(c = 2:3, d = 4)))
#> [1] 1 2 3 4