Flash Sale | 50% off
Get 50% off unlimited learning

meta (version 1.1-2)

addvar: Additional functions for objects of class meta

Description

The 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 conduct sub-group analysis or meta-regression.

Usage

## 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)

Arguments

x
An object of class meta.
row.names
NULL or a character vector giving the row names for the data frame.
optional
logical. If TRUE, setting row names and converting column names (to syntactic names) is optional.
y
A data frame with an additional covariate
varname
A character specifying name of additional variable
by.x, by.y
Specifications of the common columns (see merge)
...
other arguments

Value

  • A data frame is returned by the function 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 Also

metabin, metacont, metagen

Examples

Run this code
data(Fleiss93cont)
meta1 <- metacont(n.e, mean.e, sd.e, n.c, mean.c, sd.c, study,
                  data=Fleiss93cont, sm="SMD")
#
# Generate additional variable
#
Fleiss93cont$group <- c(1,2,1,1,2)
#
# Generate new variable by merging
# object 'meta1' and data frame 'Fleiss93cont'
#
meta1$group <- addvar(meta1, Fleiss93cont, "group", by.y="study")
as.data.frame(meta1)
summary(meta1, byvar=group)

Run the code above in your browser using DataLab