Learn R Programming

pcnetmeta (version 1.1)

nma.networkplot: Network plot of treatment comparisons

Description

nma.networkplot plots a visual network presenting comparisons of treatments in various studies.

Usage

nma.networkplot(c1, c2, percomparison, trtname, weight = FALSE, VAR1,
                graphtitle, thickness, nodetextsize, nodesize)

Arguments

c1
a numeric vector of natural numbers. If the third argument percomparison is set as TRUE, c1 represents treatment ID; otherwise, it represents study ID.
c2
a numeric vector of natural numbers indicating treatment ID.
percomparison
logical. If TRUE, c1 would be treated as the treatment in the first arm of a comparison while c2 would be the second arm; otherwise, c1 is the study ID column while c2 is the treatment vecto
trtname
a vector of character string indicating the treatment names. It is optional, and the default is "treat.1", "treat.2", and so on.
weight
logical. If TRUE, the weights of edges (i.e., total number of corresponding comparison in the network study) would be shown in the network plot. The default is FALSE.
VAR1
a numeric vector used to plot the size of each node according to a treatment characteristic, e.g., by providing a vector with the sample size randomized in each treatment. It is an optional argument, and the default is to plot the node proportional to the
graphtitle
a character string indicating the gragh title. It is optional, and the default is to plot without a title.
thickness
a numeric value used to change the thickness of the edges. It is optional, and the default is 10.
nodetextsize
a numeric value used to change the text size of the node label. It is optional, and the default is 1.
nodesize
a numeric value used to change the size of nodes. It is optional, and the default is 5.

Value

  • A network plot is generated by this function. Each node in the plot represents a treatment, and the links between nodes indicate studies comparing pairs of corresponding treatments.

Warning

When large values given to the nodetextsize argument (e.g., larger than 4), the graph might be forced out of the margins.

References

Butts CT (2008). "network: A Package for Managing Relational Data in R." J Stat Softw, 24(2), 1--36.

Examples

Run this code
t1 <- c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 1, 3, 2, 3)
t2 <- c(2, 3, 4, 4, 5, 5, 8, 8, 8, 8, 10, 7, 9, 9, 9, 10, 6, 6, 3, 4)
nma.networkplot(c1 = t1, c2 = t2, percomparison = TRUE)

## network plot for network Ara 2009
data(Ara09)
attach(Ara09)
nma.networkplot(c1 = Study.ID, c2 = Treatment, percomparison = FALSE,
                weight = TRUE, graphtitle = "Ara 2009")
detach(Ara09)

## network plot for network Lam 2007
data(Lam07)
attach(Lam07$data)
nma.networkplot(c1 = Study.ID, c2 = Treatment, percomparison = FALSE,
                trtname = Lam07$trtname, graphtitle = "Lam 2007")
detach(Lam07$data)

Run the code above in your browser using DataLab