restructure_as_list: Restructure Data Matrix as List

View source: R/general_helpers.R

restructure_as_listR Documentation

Restructure Data Matrix as List

Description

This function restructures neighborhood information given by a data matrix containing all information and one neighborhood assignment vector. It returns a list of data matrices used in ssMRCD.

Usage

restructure_as_list(data, groups)

Arguments

data

data matrix with all observations.

groups

numeric neighborhood assignment vector.

Value

Returns a list containing the observations per neighborhood assignment. The list is sorted according to the order of the first appearance in the groups vector.

Examples


# data matrix
data = matrix(rnorm(n = 3000), ncol = 3)
N_assign = sample(x = 1:10, size = 1000, replace = TRUE)

restructure_as_list(data, N_assign)


ssMRCD documentation built on Sept. 11, 2024, 5:14 p.m.