sLlapply: Shortcut to a 'lapply' equivalent to apply a function to a...

Description Usage Arguments Value Examples

View source: R/scanList_tools.R

Description

Shortcut to a lapply equivalent to apply a function to a list of scanList: a sLlist object Written analogously to lapply()

Usage

1
sLlapply(sLlist, FUN, ...)

Arguments

sLlist

a sLlist object, a list of scanList objects (see perform_exp())

FUN

function, to be applied to each scanList objects in sLlist

...

extra argument to be passed, notably named arguments used by FUN (see lapply())

Value

a sLlist object, a list of scanList objects on which the function FUN has been applied (see perform_exp())

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
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

# 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")

R-KenK/SimuNet documentation built on Oct. 22, 2021, 1:27 a.m.