Sets a vertex attribute on an object of class network
.
This function simplifies the related function in the
network
package.
Details
This function is used in EpiModel
workflows to set vertex attributes
on an initialized empty network object (see network_initialize
.
Examples
nw <- network_initialize(100)
nw <- set_vertex_attribute(nw, "age", runif(100, 15, 65))
nw
#> Network attributes:
#> vertices = 100
#> directed = FALSE
#> hyper = FALSE
#> loops = FALSE
#> multiple = FALSE
#> bipartite = FALSE
#> total edges= 0
#> missing edges= 0
#> non-missing edges= 0
#>
#> Vertex attribute names:
#> age vertex.names
#>
#> No edge attributes