我正在使用 RMarkdown 并试图在我的 Anova 表中获得显着效果,在最终的 pdf 文档中显示为粗体。在这种情况下,需要加粗的行是表的第二行(列名是第一行)。
使用papaja包:链接到 GitHub
这就是我进行方差分析的方式
library(apaTables)
library(MOTE)
data("iris")
ManCheck2.1 <- aov(formula = Sepal.Length ~ Sepal.Width * Petal.Length, data = iris)
ManCheck2.1APA <- apa_print(ManCheck2.1)
这就是我准备明细表所做的
M2 <- apa.aov.table(ManCheck2.1, conf.level = .95)
M2table <- M2$table_body
# Delete the "(Intercept)" line:
M2table <- M2table[-1, ]
# Swap the p-values with the formatted version from our apa_print() object IMPORTANT
M2table[2,6] <- as.character(ManCheck2.1APA$table$p[2])
M2table[1,6] <- as.character(ManCheck2.1APA$table$p[1])
M2table[3,6] <- as.character(ManCheck2.1APA$table$p[3])
# Rename the rows
M2table[ ,1] <- c("Company Motive", "CSR", "Company Motive * CSR", "Error")
colnames(M2table) <- c("Predictor", "$SS$", "$df$", "$MS$", "$F$", "$p$",
"$\\eta^{2}_{partial}$", "$\\eta^{2}_{partial}$ 95\\% CI")
这是在我的针织文档中显示表格的代码块。
apa_table(M2table, caption = "Effects of self- (versus other-oriented motive) and high CSR (versus neutral CSR) on perceived company motive", note = "Significant effects are bold", align = c("l", "r", "r", "r", "r", "r", "r", "c"), escape = F, row.names = F, # after manipulating the data frame, apa_table() started to show # the row numbers, so we had to choose "rownames = F" placement= "h")