as.igraph.nma_data {multinma} | R Documentation |
Convert networks to graph objects
Description
The method as.igraph()
converts nma_data
objects into the form used by
the igraph package. The method as_tbl_graph()
converts nma_data
objects
into the form used by the ggraph and
tidygraph packages.
Usage
## S3 method for class 'nma_data'
as.igraph(x, ..., collapse = TRUE)
## S3 method for class 'nma_data'
as_tbl_graph(x, ...)
Arguments
x |
An nma_data object to convert |
... |
Additional arguments |
collapse |
Logical, collapse edges over studies? Default |
Value
An igraph
object for as.igraph()
, a tbl_graph
object for
as_tbl_graph()
.
Examples
# Set up network of smoking cessation data
head(smoking)
smk_net <- set_agd_arm(smoking,
study = studyn,
trt = trtc,
r = r,
n = n,
trt_ref = "No intervention")
# Print details
smk_net
# Convert to igraph object
igraph::as.igraph(smk_net) # Edges combined by default
igraph::as.igraph(smk_net, collapse = FALSE) # Without combining edges
# Convert to tbl_graph object
tidygraph::as_tbl_graph(smk_net) # Edges combined by default
tidygraph::as_tbl_graph(smk_net, collapse = FALSE) # Without combining edges
[Package multinma version 0.7.1 Index]