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.
## 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 TRUE, only one edge is produced for each comparison (by IPD or AgD study type) with a .nstudy attribute giving the number of studies making that comparison. If FALSE, repeated edges are added for each study making the comparison.
Returns
An igraph object for as.igraph(), a tbl_graph object for as_tbl_graph().
Examples
# Set up network of smoking cessation datahead(smoking)smk_net <- set_agd_arm(smoking, study = studyn, trt = trtc, r = r, n = n, trt_ref ="No intervention")# Print detailssmk_net
# Convert to igraph objectigraph::as.igraph(smk_net)# Edges combined by defaultigraph::as.igraph(smk_net, collapse =FALSE)# Without combining edges# Convert to tbl_graph objecttidygraph::as_tbl_graph(smk_net)# Edges combined by defaulttidygraph::as_tbl_graph(smk_net, collapse =FALSE)# Without combining edges