Function to convert summary data in vector format to the corresponding table format.

to.table(measure, ai, bi, ci, di, n1i, n2i, x1i, x2i, t1i, t2i,
         m1i, m2i, sd1i, sd2i, xi, mi, ri, ti, sdi, ni, data, slab, subset,
         add=1/2, to="none", drop00=FALSE, rows, cols)

Arguments

measure

a character string to specify the effect size or outcome measure corresponding to the summary data supplied. See ‘Details’ and the documentation of the escalc function for possible options.

ai

vector with the \(2 \times 2\) table frequencies (upper left cell).

bi

vector with the \(2 \times 2\) table frequencies (upper right cell).

ci

vector with the \(2 \times 2\) table frequencies (lower left cell).

di

vector with the \(2 \times 2\) table frequencies (lower right cell).

n1i

vector with the group sizes or row totals (first group/row).

n2i

vector with the group sizes or row totals (second group/row).

x1i

vector with the number of events (first group).

x2i

vector with the number of events (second group).

t1i

vector with the total person-times (first group).

t2i

vector with the total person-times (second group).

m1i

vector with the means (first group or time point).

m2i

vector with the means (second group or time point).

sd1i

vector with the standard deviations (first group or time point).

sd2i

vector with the standard deviations (second group or time point).

xi

vector with the frequencies of the event of interest.

mi

vector with the frequencies of the complement of the event of interest or the group means.

ri

vector with the raw correlation coefficients.

ti

vector with the total person-times.

sdi

vector with the standard deviations.

ni

vector with the sample/group sizes.

data

optional data frame containing the variables given to the arguments above.

slab

optional vector with labels for the studies.

subset

optional (logical or numeric) vector to specify the subset of studies that should be included in the array returned by the function.

add

see the documentation of the escalc function.

to

see the documentation of the escalc function.

drop00

see the documentation of the escalc function.

rows

optional vector with row/group names.

cols

optional vector with column/outcome names.

Details

The escalc function describes a wide variety of effect sizes or outcome measures that can be computed for a meta-analysis. The summary data used to compute those measures are typically contained in vectors, each element corresponding to a study. The to.table function takes this information and constructs an array of \(k\) tables from these data.

For example, in various fields (such as the health and medical sciences), the response variable measured is often dichotomous (binary), so that the data from a study comparing two different groups can be expressed in terms of a \(2 \times 2\) table, such as:

outcome 1outcome 2total
group 1aibin1i
group 2cidin2i

where ai, bi, ci, and di denote the cell frequencies (i.e., the number of individuals falling into a particular category) and n1i and n2i the row totals (i.e., the group sizes).

The cell frequencies in \(k\) such \(2 \times 2\) tables can be specified via the ai, bi, ci, and di arguments (or alternatively, via the ai, ci, n1i, and n2i arguments). The function then creates the corresponding \(2 \times 2 \times k\) array of tables. The measure argument should then be set equal to one of the outcome measures that can be computed based on this type of data, such as "RR", "OR", "RD" (it is not relevant which specific measure is chosen, as long as it corresponds to the specified summary data). See the documentation of the escalc function for more details on the types of data formats available.

The examples below illustrate the use of this function.

Value

An array with \(k\) elements each consisting of either 1 or 2 rows and an appropriate number of columns.

References

Viechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package. Journal of Statistical Software, 36(3), 1–48. https://doi.org/10.18637/jss.v036.i03

See also

escalc for a function to compute observed effect sizes or outcomes (and corresponding sampling variances) based on similar inputs.

to.long for a function to turn similar inputs into a long format dataset.

Examples

### create tables
dat <- to.table(measure="OR", ai=tpos, bi=tneg, ci=cpos, di=cneg,
                data=dat.bcg, slab=paste(author, year, sep=", "),
                rows=c("Vaccinated", "Not Vaccinated"), cols=c("TB+", "TB-"))
dat
#> , , Aronson, 1948
#> 
#>                TB+ TB-
#> Vaccinated       4 119
#> Not Vaccinated  11 128
#> 
#> , , Ferguson & Simes, 1949
#> 
#>                TB+ TB-
#> Vaccinated       6 300
#> Not Vaccinated  29 274
#> 
#> , , Rosenthal et al, 1960
#> 
#>                TB+ TB-
#> Vaccinated       3 228
#> Not Vaccinated  11 209
#> 
#> , , Hart & Sutherland, 1977
#> 
#>                TB+   TB-
#> Vaccinated      62 13536
#> Not Vaccinated 248 12619
#> 
#> , , Frimodt-Moller et al, 1973
#> 
#>                TB+  TB-
#> Vaccinated      33 5036
#> Not Vaccinated  47 5761
#> 
#> , , Stein & Aronson, 1953
#> 
#>                TB+  TB-
#> Vaccinated     180 1361
#> Not Vaccinated 372 1079
#> 
#> , , Vandiviere et al, 1973
#> 
#>                TB+  TB-
#> Vaccinated       8 2537
#> Not Vaccinated  10  619
#> 
#> , , TPT Madras, 1980
#> 
#>                TB+   TB-
#> Vaccinated     505 87886
#> Not Vaccinated 499 87892
#> 
#> , , Coetzee & Berjak, 1968
#> 
#>                TB+  TB-
#> Vaccinated      29 7470
#> Not Vaccinated  45 7232
#> 
#> , , Rosenthal et al, 1961
#> 
#>                TB+  TB-
#> Vaccinated      17 1699
#> Not Vaccinated  65 1600
#> 
#> , , Comstock et al, 1974
#> 
#>                TB+   TB-
#> Vaccinated     186 50448
#> Not Vaccinated 141 27197
#> 
#> , , Comstock & Webster, 1969
#> 
#>                TB+  TB-
#> Vaccinated       5 2493
#> Not Vaccinated   3 2338
#> 
#> , , Comstock et al, 1976
#> 
#>                TB+   TB-
#> Vaccinated      27 16886
#> Not Vaccinated  29 17825
#> 

### create tables
dat <- to.table(measure="IRR", x1i=x1i, x2i=x2i, t1i=t1i, t2i=t2i,
                data=dat.hart1999, slab=paste(study, year, sep=", "),
                rows=c("Warfarin Group", "Placebo/Control Group"))
dat
#> , , AFASAK, 1989
#> 
#>                       Events Person-Time
#> Warfarin Group             9         413
#> Placebo/Control Group     19         398
#> 
#> , , SPAF, 1991
#> 
#>                       Events Person-Time
#> Warfarin Group             8         263
#> Placebo/Control Group     19         245
#> 
#> , , BAATAF, 1990
#> 
#>                       Events Person-Time
#> Warfarin Group             3         487
#> Placebo/Control Group     13         435
#> 
#> , , CAFA, 1991
#> 
#>                       Events Person-Time
#> Warfarin Group             6         237
#> Placebo/Control Group      9         241
#> 
#> , , SPINAF, 1992
#> 
#>                       Events Person-Time
#> Warfarin Group             7         489
#> Placebo/Control Group     23         483
#> 
#> , , EAFT, 1993
#> 
#>                       Events Person-Time
#> Warfarin Group            20         507
#> Placebo/Control Group     50         405
#> 

### create tables
dat <- to.table(measure="MD", m1i=m1i, sd1i=sd1i, n1i=n1i,
                m2i=m2i, sd2i=sd2i, n2i=n2i, data=dat.normand1999,
                slab=source, rows=c("Specialized Care", "Routine Care"))
dat
#> , , Edinburgh
#> 
#>                  Mean SD   n
#> Specialized Care   55 47 155
#> Routine Care       75 64 156
#> 
#> , , Orpington-Mild
#> 
#>                  Mean SD  n
#> Specialized Care   27  7 31
#> Routine Care       29  4 32
#> 
#> , , Orpington-Moderate
#> 
#>                  Mean SD  n
#> Specialized Care   64 17 75
#> Routine Care      119 29 71
#> 
#> , , Orpington-Severe
#> 
#>                  Mean SD  n
#> Specialized Care   66 20 18
#> Routine Care      137 48 18
#> 
#> , , Montreal-Home
#> 
#>                  Mean SD  n
#> Specialized Care   14  8  8
#> Routine Care       18 11 13
#> 
#> , , Montreal-Transfer
#> 
#>                  Mean SD  n
#> Specialized Care   19  7 57
#> Routine Care       18  4 52
#> 
#> , , Newcastle
#> 
#>                  Mean SD  n
#> Specialized Care   52 45 34
#> Routine Care       41 34 33
#> 
#> , , Umea
#> 
#>                  Mean SD   n
#> Specialized Care   21 16 110
#> Routine Care       31 27 183
#> 
#> , , Uppsala
#> 
#>                  Mean SD  n
#> Specialized Care   30 27 60
#> Routine Care       23 20 52
#>