Search code examples
rmetafor

writing ouput from anova.rma(metafor) to a csv or dataframe


I have done multiple anova.rma functions from the metafor package to compare 2 vs. 3 level models in a meta-analysis, and the output in the console is a nice table. I would like to write this to a csv so that I can store these results, however the object that is saved in the environment is a list and I am having trouble actually writing this output in a nice format. Does anyone have any suggestions?

Update: I added an example data and script so that maybe others can reproduce the problem I have been having easier https://github.com/jmmakoshark/anova.rma/blob/main/anova_rma_ex.csv https://github.com/jmmakoshark/anova.rma/blob/main/anova_rma_ex.r

output from console


Solution

  • There is an as.data.frame() method for anova.rma objects. So, just do as.data.frame(anova(...)) and then you get a plain data frame that you can write to a csv file.