简体   繁体   English

在表格中显示事后 Tukey 分析的问题

[英]Problem in showing post-hoc Tukey analysis in a table

I think this is a stupid question, but I am kind of stuck.我认为这是一个愚蠢的问题,但我有点卡住了。 I want to put my posthoc Tukey analysis in a table, however, I am not able to do that.我想将我的 posthoc Tukey 分析放在一个表格中,但是,我无法做到这一点。 The steps I followed are: First, I converted the posthoc Tukey result into a data frame then I used the gt package to make a table.我遵循的步骤是:首先,我将 posthoc Tukey 结果转换为数据框,然后使用 gt 包制作表格。

The problem is I am not able to show my groups in the table, in this case the name of the islands问题是我无法在表格中显示我的组,在这种情况下是岛屿的名称

This is the code I am using这是我正在使用的代码

Tuk_anova1 <- TukeyHSD(AnovaModel.1)
Tuk_anova1 <- TukeyHSD(AnovaModel.1)
Tuk_anova1
TK <-as.data.frame(Tuk_anova1$Island)
gt_tbl <- gt(TK)
gt_tbl

The table I am getting TukeyHSD result我得到TukeyHSD 结果的表

You need to use the rownames_to_stub=TRUE argument.您需要使用rownames_to_stub=TRUE参数。 Here is an example:下面是一个例子:

library(gt)
data(iris)
iris.aov <- aov(Sepal.Width~Species, iris)
iris.hsd <- TukeyHSD(iris.aov)
iris.df <- as.data.frame(iris.hsd$Species)
gt_tbl <- gt(iris.df, rownames_to_stub=TRUE)
gt_tbl

桌子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM