I'm a beginner in R and I'm trying to run a meta-analysis of correlations, but when I try to plot the data in a plot I get an error. I am learning the code from: https://www.youtube.com/watch?v=d1pYHfCKhyA I would really appreciate any help or advise you can give me. This is my code:
install.packages("metafor")
install.packages("robumeta")
install.packages("dplyr")
library(metafor)
library(robumeta)
library(dplyr)
Main<- read.csv("Meta-main.csv")
Main <- mutate(Main, study_id = 1:23)
Main <- Main %>% select(study_id, Authur:Quality)
View(Main)
Main <-escalc(measure = "ZCOR", ri=EffSize, ni=Ssize, data = Main, slab = paste(Authur, Year, sep = ", "))
View(Main)
res <- rma(yi, vi, data = Main)
res
predict(res, digits = 3, transf = transf.ztor)
confint(res)
b_res <- rma(yi, vi, data = Main, slab = study_id)
baujat(b_res)
inf<-influence(res)
print(inf)
plot(inf)
forest(res, xlim=c(-1.6,1.6), atransf = transf.ztor,
at = transf.rtoz(c(-4,-2,0,.2,.4,.6)), digits = c(2,1),cex = .8)
This is the error:
Error in plot.window(...) : need finite 'xlim' values
I tried to solve it myself by x<-1.6:1.6 but I don't really know what I'm doing.
The problem is that at=transf.rtoz(c(-4,-2,0,.2,.4,.6))
yields -Inf
and Inf
values. I think you meant to use at=transf.rtoz(c(-.4,-.2,0,.2,.4,.6))
and then it should work.