as.data.frame
method returns a data frame containing
information on individual studies, e.g., estimated treatment effect
and its standard error. The function addvar
can be used to add
a single variable to an object of class meta
which for example
is useful to add columns to a forest plot.## S3 method for class 'meta':
as.data.frame(x, row.names=NULL, optional=FALSE, ...)addvar(x, y, varname, by.x="studlab", by.y=by.x)
meta
.NULL
or a character vector giving the row
names for the data frame.TRUE
, setting row names and
converting column names (to syntactic names) is optional.merge
)as.data.frame
. A single covariate is returned by the function addvar
which
can be added to an object of class meta
. Internally, the
merge
function is utilised. See help page
metagen
for an example on the use of R function
addvar.
metabin
, metacont
, metagen
, forest.meta
data(Fleiss93cont)
#
# Generate additional variable with grouping information
#
Fleiss93cont$group <- c(1,2,1,1,2)
#
# Do meta-analysis without grouping information
#
meta1 <- metacont(n.e, mean.e, sd.e, n.c, mean.c, sd.c, study,
data=Fleiss93cont, sm="SMD")
#
# Update meta-analysis object and do subgroup analyses
#
summary(update(meta1, byvar=group))
#
# Same result using metacont function directly
#
meta2 <- metacont(n.e, mean.e, sd.e, n.c, mean.c, sd.c, study,
data=Fleiss93cont, sm="SMD", byvar=group)
summary(meta2)
#
# Compare printout of the following two commands
#
as.data.frame(meta1)
meta1$data
Run the code above in your browser using DataLab