R/scanList_matList_conversion.R
scanList2matList.Rd
Convenience function to allow the use of functions designed to affect list of matrices instead of
3D array (specifically scanList
objects) where the 3rd dimension is the scan index. Keeps track
of the attributes list attrs
scanList2matList(scan.list)
scan.list | a 3 dimensional array representing adjacency matrices (first 2 dimensions) throughout the different scans (3rd dimension) |
---|
a list of matrices where each element is the 2D matrix for each scan index (3rd dimension of array.3D
)
To back-transform a list of matrices into a scanList
object, users can use
matList2array()
, wrapper to simplify2array()
that
handles attributes list attrs
set.seed(42) n <- 5L samp.effort <- 100L # Adjacency matrix import ## random directed adjacency matrix Adj <- sample(1:samp.effort,n * n) |> matrix(nrow = 5,dimnames = list(letters[1:n],letters[1:n])) Adj[lower.tri(Adj,diag = TRUE)] <- 0L Adj#> a b c d e #> a 0 100 37 27 58 #> b 0 0 20 36 42 #> c 0 0 0 5 93 #> d 0 0 0 0 30 #> e 0 0 0 0 0#> [[1]] #> #> scan: #> a . 1 1 . 1 #> b . . . . . #> c . . . . 1 #> d . . . . . #> e . . . . . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob #> #> [[2]] #> #> scan: #> a . 1 . . . #> b . . . . 1 #> c . . . . 1 #> d . . . . . #> e . . . . . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob #> #> [[3]] #> #> scan: #> a . 1 . . . #> b . . . . 1 #> c . . . . 1 #> d . . . . . #> e . . . . . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob #> #> [[4]] #> #> scan: #> a . 1 1 . 1 #> b . . . . 1 #> c . . . . . #> d . . . . . #> e . . . . . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob #> #> [[5]] #> #> scan: #> a . 1 . . 1 #> b . . . 1 . #> c . . . . 1 #> d . . . . . #> e . . . . . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob #> #> [[6]] #> #> scan: #> a . 1 1 . 1 #> b . . 1 . 1 #> c . . . . 1 #> d . . . . 1 #> e . . . . . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob #> #> [[7]] #> #> scan: #> a . 1 . 1 . #> b . . . 1 1 #> c . . . . 1 #> d . . . . 1 #> e . . . . . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob #> #> [[8]] #> #> scan: #> a . 1 1 . . #> b . . . . 1 #> c . . . . 1 #> d . . . . . #> e . . . . . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob #> #> [[9]] #> #> scan: #> a . 1 . . 1 #> b . . . . 1 #> c . . . . 1 #> d . . . . . #> e . . . . . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob #> #> [[10]] #> #> scan: #> a . 1 . 1 1 #> b . . . . . #> c . . . . 1 #> d . . . . . #> e . . . . . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob #> #> attr(,"class") #> [1] "theoretical" "matList" #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob#> #> scan: 1 #> a . 1 1 . 1 #> b . . . . . #> c . . . . 1 #> d . . . . . #> e . . . . . #> #> scan: 2 #> a . 1 . . . #> b . . . . 1 #> c . . . . 1 #> d . . . . . #> e . . . . . #> #> ... ( 7 more scans) #> #> scan: 10 #> a . 1 . 1 1 #> b . . . . . #> c . . . . 1 #> d . . . . . #> e . . . . . #> #> #> Hidden attributes: #> scanList.type - raw.scanList - Adj - samp.effort - n.scans - mode #> Adj.subfun - edge.Prob#> [1] TRUE