attrs: 'scanList"s 'attrs' attributes related convenience functions:...

Description Usage Arguments Value Examples

View source: R/scanList_tools.R

Description

scanList's attrs attributes related convenience functions: retrieve or modify attributes attrs() and attrs()<- can be used to retrieve the named attributes contained in the attributes list attrs of a scanList object

Usage

1
attrs(scan.list, a = NULL)

Arguments

scan.list

a scanList object (see simunet())

a

character (scalar or vector), the name(s) of the attribute(s) to retrieve, modify or add

Value

the attribute(s) requested, or the scan.list which attrs attribute has been modified

Examples

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

# retrieve all attributes in `attrs`
sL |> attrs()

# retrieve a specific attribute from `attrs`
sL |> attrs("edge.Prob")

# modify a specific attribute from `attrs` (internal use)
attrs(sL,"scanList.type") <- "empirical"
attrs(sL,"scanList.type")

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