lapply
equivalent to apply a function to a list of scanList
: a sLlist
object
Written analogously to lapply()
R/scanList_tools.R
sLlapply.Rd
Shortcut to a lapply
equivalent to apply a function to a list of scanList
: a sLlist
object
Written analogously to lapply()
sLlapply(sLlist, FUN, ...)
sLlist | a |
---|---|
FUN | function, to be applied to each |
... | extra argument to be passed, notably named arguments used by |
a sLlist
object, a list of scanList
objects on which the function FUN
has been
applied (see perform_exp()
)
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# Designing the experiments: ## setting a constant probability of not observing edges group.scan <- design_sampling(method = "group",sampling = 0.8) ## setting an even focal sampling focal.scan <- design_sampling(method = "focal",sampling = "even") sL <- simunet(Adj = Adj,samp.effort = samp.effort,mode = "upper",n.scans = 120L) sL |> perform_exp(group.scan,focal.scan) |> sLlapply(attrs,a = "edge.Prob")#> [[1]] #> #> Edge presence probability matrix #> a . 0.992 0.391 0.253 0.633 #> b . . 0.217 0.406 0.423 #> c . . . 0.076 0.921 #> d . . . . 0.257 #> e . . . . . #> #> alpha.prior = 0.5 - beta.prior = 0.5 #> [[2]] #> #> Edge presence probability matrix #> a . 0.992 0.391 0.253 0.633 #> b . . 0.217 0.406 0.423 #> c . . . 0.076 0.921 #> d . . . . 0.257 #> e . . . . . #> #> alpha.prior = 0.5 - beta.prior = 0.5 #> attr(,"class") #> [1] "sLlist"