There are multiple issues here. First of all, you should simplify your code to:
metacor(cor, n, title="title", complab="comparison",
outclab="outcome")
The rest of your call to metacor() is just using the defaults, so no need to
repeat all of that in your call and apparently one of these arguments is causing
some problems.
Second, your vector of "correlations" (cor) includes values below -1,
which is impossible if these are supposed to be Pearson product-moment
correlation coefficients.
Finally, note that the sampling variance of an r-to-z transformed correlation is
calculated with 1/(n-3), so you get division by zero when n=3. As far as I can
tell, metacor() will handle this by setting the weight for these values to 0. It
is certainly unusual to meta-analyze correlations, where some of those
correlations are based on only 3 observations.
Best,
Wolfgang
--
Wolfgang Viechtbauer, Ph.D., Statistician
Department of Psychiatry and Psychology
School for Mental Health and Neuroscience
Faculty of Health, Medicine, and Life Sciences
Maastricht University, P.O. Box 616 (VIJV1)
6200 MD Maastricht, The Netherlands
+31 (43) 388-4170 | http://www.wvbauer.com
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at
r-project.org]
> On Behalf Of Catherine Proulx
> Sent: Monday, November 19, 2012 18:55
> To: r-help at r-project.org
> Subject: [R] Help: Meta-analysis with metacor
>
>
> Trying to do a meta-analysis of correlations in R using the meta package;
> have tried several things and keep getting a similar error. Can anyone
> help explain the error?
> > cor<-c(-0.3018, 0.667, -3.8002, -0.607, -0.4885, -3.8002, -0.0701,
> 0.1348, -0.9505, -0.5709, -0.6127, -1.2419, -0.1511, -0.1054)> n<-
> c(3,4,3,3,3,3,16,36,30,9,3,3,30,4)> library(meta)> metacor(cor, n,
> data=NULL, subset=NULL, sm="ZCOR", level=0.95, level.comb=level,
> comb.fixed=TRUE, comb.random=TRUE, hakn=NULL, method.tau="DL",
> tau.preset=NULL, TE.tau=NULL, method.bias="linreg",
title="title",
> complab="comparison", outclab="outcome")
> Error in data.frame(subset = NULL, comb.fixed = TRUE, comb.random = TRUE,
> : arguments imply differing number of rows: 0, 1
> Thanks,
> Catherine
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.