This function transforms data from pairwise comparisons to a long arm-based format, i.e., two rows for a pairwise comparison.
longarm(
treat1,
treat2,
event1,
n1,
event2,
n2,
mean1,
sd1,
mean2,
sd2,
time1,
time2,
data = NULL,
studlab,
id1 = NULL,
id2 = NULL,
append = TRUE,
keep.duplicated = FALSE,
keep.internal = FALSE
)
A data frame in long arm-based format.
Either label for first treatment or a meta-analysis or pairwise object (see Details).
Label for second treatment.
Number of events (first treatment).
Number of observations (first treatment).
Number of events (second treatment).
Number of observations (second treatment)
Estimated mean (first treatment).
Standard deviation (first treatment).
Estimated mean (second treatment).
Standard deviation (second treatment).
Person time at risk (first treatment)
Person time at risk (second treatment)
An optional data frame containing the study information.
A vector with study labels (optional).
Last character(s) of variable names for additional variables with group specific information for first treatment.
Last character(s) of variable names for additional variables with group specific information for second treatment.
A logical indicating if data frame provided in argument 'data' should be returned.
A logical indicating if duplicated rows should be returned (see Details).
A logical indicating if variables generated internally should be returned (typically only relevant for data checking).
Guido Schwarzer guido.schwarzer@uniklinik-freiburg.de
This function transforms data given as one pairwise comparison per row to a long arm-based format with one row per treatment arm. The long arm-based format is, for example, the required input format for WinBUGS.
The function can be used to transform data with a binary,
continuous or count outcome. The corresponding meta-analysis
functions are metabin
, metacont
and
metainc
. Accordingly, a meta-analysis object created
with one of these functions can be provided as argument
treat1
. It is also possible to use the longarm function with
an R objected created with pairwise
from R
package netmeta.
Otherwise, arguments treat1
and treat2
are mandatory
to identify the individual treatments and, depending on the
outcome, the following additional arguments are mandatory:
event1, n1, event2, n2 (binary outcome);
n1, mean1, sd1, n2, mean2, sd2 (continuous outcome);
time1, n1, time2, n2 (count outcome).
Argument studlab
must be provided if several pairwise
comparisons come from a single study with more than two treatments.
The following variables will be returned:
studlab | study label |
treat | treatment label |
n | group sample size (count outcome only if provided) |
events | number of events (binary or count outcome) |
nonevents | number of non-events (binary outcome) |
mean | estimated mean (continuous outcome) |
sd | standard deviation (continuous outcome) |
time | person time at risk (count outcome) |
In addition, the data set provided in argument data
will be
returned if argument append = TRUE
(default).
Argument keep.duplicated
can be used to keep duplicated rows
from the data set. Duplicated rows can occur, for example, in a
three-arm study comparing treatments A and B with placebo. In this
situation, the placebo arm will be returned twice in the data set
in long arm-based format if keep.duplicated = TRUE
. By
default, duplicated rows with not be kept in the data set.
metabin
, metacont
,
metainc
, pairwise
# Artificial example with three studies
m <- metabin(1:3, 100:102, 4:6, 200:202, studlab = LETTERS[1:3])
# Transform data to long arm-based format
longarm(m)
# Keep internal variables
longarm(m, keep.internal = TRUE)
Run the code above in your browser using DataLab