treat1: Either label for first treatment or a meta-analysis or pairwise object (see Details).
treat2: Label for second treatment.
event1: Number of events (first treatment).
n1: Number of observations (first treatment).
event2: Number of events (second treatment).
n2: Number of observations (second treatment)
mean1: Estimated mean (first treatment).
sd1: Standard deviation (first treatment).
mean2: Estimated mean (second treatment).
sd2: Standard deviation (second treatment).
time1: Person time at risk (first treatment)
time2: Person time at risk (second treatment)
data: An optional data frame containing the study information.
studlab: A vector with study labels (optional).
id1: Last character(s) of variable names for additional variables with group specific information for first treatment.
id2: Last character(s) of variable names for additional variables with group specific information for second treatment.
append: A logical indicating if data frame provided in argument 'data' should be returned.
keep.duplicated: A logical indicating if duplicated rows should be returned (see Details).
keep.internal: A logical indicating if variables generated internally should be returned (typically only relevant for data checking).
Returns
A data frame in long arm-based format.
Details
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.
Otherwise, arguments treat1 and treat2 are mandatory to identify the individual treatments and, depending on the outcome, the following additional arguments are mandatory:
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.
Note
R function to.long from R package metafor is called internally.
Examples
# Artificial example with three studiesm <- metabin(1:3,100:102,4:6,200:202, studlab = LETTERS[1:3])# Transform data to long arm-based formatlongarm(m)# Keep internal variableslongarm(m, keep.internal =TRUE)