Description Usage Arguments Value Examples
View source: R/scanList_tools.R
Shortcut to a lapply
equivalent to apply a function to each 2D matrix contained in a scanList
Written analogously to vapply()
. Values returned by .f
should be a similarly dimensionned
matrix as the first one contained in the 3D array
1 |
sL |
a |
FUN |
a function, to apply to each 2D matrix contained in |
... |
extra argument to be passed, notably named arguments used by |
a 3D array onto which the function has been applied to each scan
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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
sL <- simunet(Adj = Adj,samp.effort = samp.effort,mode = "upper",n.scans = 120L)
sL |> sLapply(function(scan) {scan[1,2] <- NA;scan})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.