Search code examples
rdataframeexportemmeans

How to export to a dataframe results from emmeans contrast()?


After running the test (model1.emm=emmeans(model1,~timeBin) contrast(model1.emm, "trt.vs.ctrl", ref = 1, adjust='fdr')), here is what I see in Console: enter image description here

Would it be possible to export this output to a dataframe?

I learned how to export the rest of the results: result = as.data.frame(summary(model1.emm))

enter image description here


Solution

  • Export it the same way. The result of contrast() is an emmGrid object, the same class as from emmeans(). You may use summary() or as.data.frame() — no need to use both.