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
objectR/scanList_tools.R
attrs-set.Rd
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
attrs(x, which) <- value
x | a |
---|---|
which | character (scalar or vector), the name(s) of the attribute(s) to retrieve, modify or add |
value | object to replace the requested attribute with |
the scan.list
which attrs
attribute has been modified
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 0sL <- simunet(Adj = Adj,samp.effort = samp.effort,mode = "upper",n.scans = 120L) # retrieve all attributes in `attrs` sL |> attrs()#> $scanList.type #> [1] "theoretical" #> #> $raw.scanList #> #> scan: 1 #> a . 1 1 . 1 #> b . . . . . #> c . . . . 1 #> d . . . . . #> e . . . . . #> #> scan: 2 #> a . 1 . . . #> b . . . . 1 #> c . . . . 1 #> d . . . . . #> e . . . . . #> #> ... ( 117 more scans) #> #> scan: 120 #> a . 1 . . 1 #> b . . 1 1 . #> c . . . . 1 #> d . . . . 1 #> e . . . . . #> #> $Adj #> #> Weighted adjacency matrix #> a . 100 37 27 58 #> b . . 20 36 42 #> c . . . 5 93 #> d . . . . 30 #> e . . . . . #> #> $samp.effort #> [1] 100 #> #> $n.scans #> [1] 120 #> #> $mode #> [1] "upper" #> #> $Adj.subfun #> function (x, diag = FALSE) #> { #> d <- dim(x) #> if (length(d) != 2L) #> d <- dim(as.matrix(x)) #> if (diag) #> .row(d) <= .col(d) #> else .row(d) < .col(d) #> } #> <bytecode: 0x00000000360dd870> #> <environment: namespace:base> #> #> $edge.Prob #> #> 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#> #> 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# modify a specific attribute from `attrs` (internal use) attrs(sL,"scanList.type") <- "empirical" attrs(sL,"scanList.type")#> [1] "empirical"