methods.escalc.Rd
Methods for objects of class "escalc"
.
For the `[`
method, any variables specified as part of the i
argument will be searched for within object x
first (see ‘Examples’).
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
### calculate log risk ratios and corresponding sampling variances
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg)
### select rows where variable 'alloc' is equal to 'random'
dat[dat$alloc == "random",]
#>
#> trial author year tpos tneg cpos cneg ablat alloc yi vi
#> 1 1 Aronson 1948 4 119 11 128 44 random -0.8893 0.3256
#> 2 2 Ferguson & Simes 1949 6 300 29 274 55 random -1.5854 0.1946
#> 3 3 Rosenthal et al 1960 3 228 11 209 42 random -1.3481 0.4154
#> 4 4 Hart & Sutherland 1977 62 13536 248 12619 52 random -1.4416 0.0200
#> 7 7 Vandiviere et al 1973 8 2537 10 619 19 random -1.6209 0.2230
#> 8 8 TPT Madras 1980 505 87886 499 87892 13 random 0.0120 0.0040
#> 9 9 Coetzee & Berjak 1968 29 7470 45 7232 27 random -0.4694 0.0564
#>
### variables specified are automatically searched for within the object itself
dat[alloc == "random",]
#>
#> trial author year tpos tneg cpos cneg ablat alloc yi vi
#> 1 1 Aronson 1948 4 119 11 128 44 random -0.8893 0.3256
#> 2 2 Ferguson & Simes 1949 6 300 29 274 55 random -1.5854 0.1946
#> 3 3 Rosenthal et al 1960 3 228 11 209 42 random -1.3481 0.4154
#> 4 4 Hart & Sutherland 1977 62 13536 248 12619 52 random -1.4416 0.0200
#> 7 7 Vandiviere et al 1973 8 2537 10 619 19 random -1.6209 0.2230
#> 8 8 TPT Madras 1980 505 87886 499 87892 13 random 0.0120 0.0040
#> 9 9 Coetzee & Berjak 1968 29 7470 45 7232 27 random -0.4694 0.0564
#>
### note: this behavior is specific to 'escalc' objects; this doesn't work for regular data frames