### 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",]
### variables specified are automatically searched for within the object itself
dat[alloc == "random",]
### note: this behavior is specific to 'escalc' objects; this doesn't work for regular data frames
Run the code above in your browser using DataLab