我想知道如何从emmean of emmeans R包中提取emmGrid和SE列。我们在下面给出。
library(emmeans)
warp.lm <- lm(breaks ~ wool * tension, data = warpbreaks)
Test <- emmeans(warp.lm, specs = "wool")
Test
wool emmean SE df lower.CL upper.CL
A 31.03704 2.105459 48 26.80373 35.27035
B 25.25926 2.105459 48 21.02595 29.49257
Results are averaged over the levels of: tension
Confidence level used: 0.95
class(Test)
[1] "emmGrid"
attr(,"package")
[1] "emmeans"发布于 2018-01-26 12:37:30
summary(Test)给出了一个data.frame。
class(summary(Test))1 "summary_emm“"data.frame”
所以我们可以:
summary(Test)$emmean1 31.03704 25.25926
和
summary(Test)$SE1 2.105459 2.105459
要真正获得一个新的子设置的data.frame,您需要显式地强制类data.frame:
as.data.frame(summary(Test))[c('emmean', 'SE')]emmean SE 1 31.03704 2.105459 2 25.25926 2.105459
https://stackoverflow.com/questions/48461427
复制相似问题