Tukey 检验仅绘制显着的均值差异

Tukey test only plot significant mean differences

我尝试使用之前 post 中的以下代码:Tukey Graphing Problems in R

SigOnly <- Tukey 
SigOnly$species <- SigOnly$species[SigOnly$species[,'p adj'] < .05, ]
plot(SigOnly)

但是在尝试绘图时出现以下错误:

Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ

我可能做错了什么?

由于您没有提供带有示例数据的可重现代码,下面是一个使用 warpbreaks 示例数据的示例:

fm1 <- aov(breaks ~ wool + tension, data = warpbreaks)
res <- TukeyHSD(fm1, "tension", conf.level = 0.95)

# Filter rows with padj < 0.05
res$tension <- res$tension[res$tension[, 4] < 0.05, ];

# Plot results
plot(res);