Skip to contents

Combine the LEiDA eigenvector matrices from a list of dynR_leida results into a single matrix (or data frame) ready for cross-subject K-means clustering.

Usage

stack_leida(batch_result, add_subject_id = TRUE)

Arguments

batch_result

Named list of dynR_leida objects, as returned by batch_leida().

add_subject_id

Logical. Prepend a subject column with the subject name? Default TRUE.

Value

If add_subject_id = TRUE: a data frame with columns subject and one column per parcel (named V1, V2, ...). If FALSE: a plain numeric matrix [total_timepoints x N].

See also

Examples

set.seed(3)
ts_list <- list(
  sub01 = matrix(rnorm(10 * 200), nrow = 10),
  sub02 = matrix(rnorm(10 * 200), nrow = 10)
)
results <- batch_leida(ts_list, filter = FALSE)
leida_all <- stack_leida(results)
dim(leida_all)
#> [1] 360  11