[R-meta] catching errors in batch meta-analyses

James Pustejovsky jepu@to @end|ng |rom gm@||@com
Mon Aug 16 16:32:04 CEST 2021


I find the functions safely() and possibly() from the purrr package for
this sort of error handling stuff. For instance, create

safe_reitsma <- safely(mada::reitsma)

Then run

X_mada <- safe_reitsma(data=subset(X,SUBMA_num==iii),
correction.control="single", correction=0.5)

The result will always have two components, X_mada$result and X_mada$error.
Further details and examples here:
https://purrr.tidyverse.org/reference/safely.html

James

On Sun, Aug 15, 2021 at 5:57 PM Philippe Tadger <philippetadger using gmail.com>
wrote:

> Dear colleges
>
> In a batch of a several MA (simulation kind) I would like to capture the
> error messages (like non-convergence)  from functions like
> mada::reitsma. I have been exploring the function tryCatch but without
> been able to capture the error messages. Something like this
>
> X.mada<-vector("list",745)
> for (iii in 1:200) {
> X.mada[iii]<-tryCatch(mada::reitsma(data=subset(X,SUBMA_num==iii),
> correction.control="single", correction=0.5))
> }
>
> Ideally X.mada will store convergence and non-convergence messages.
>
> Thanks in advance for the support!
>
> --
> Kind regards
> *Philippe Tadger*
> ORCID <https://orcid.org/0000-0002-1453-4105>, Reseach Gate
> <https://www.researchgate.net/profile/Philippe-Tadger>
>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-meta-analysis mailing list
> R-sig-meta-analysis using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis
>

	[[alternative HTML version deleted]]



More information about the R-sig-meta-analysis mailing list