Skip to content

Commit

Permalink
Amending anova_tables2 to print
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyclements authored Oct 9, 2024
1 parent 9ecd1d6 commit c2bebb2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions instat/static/InstatObject/R/data_object_R6.R
Original file line number Diff line number Diff line change
Expand Up @@ -4544,17 +4544,20 @@ DataSheet$set("public", "anova_tables2", function(x_col_names, y_col_name, total
if (total) anova_mod <- anova_mod %>% tibble::add_row(` ` = "Total", dplyr::summarise(., across(where(is.numeric), sum)))
anova_mod$`F value` <- round(anova_mod$`F value`, 4)
if (sign_level) anova_mod$`Pr(>F)` <- format.pval(anova_mod$`Pr(>F)`, digits = 4, eps = 0.001)

cat(paste0("ANOVA of ", formula_str, ":\n"))
print(anova_mod)
cat("\n")
# Optionally print means
if (means) {
if (class(mod$model[[x_col_names]]) == "numeric"){
if (class(mod$model[[x_col_names]]) %in% c("numeric", "integer")){
cat("Model coefficients:\n")
print(mod$coefficients)
cat("\n")
} else {
cat(paste0("Means table of ", y_col_name, ":\n"))
print(model.tables(aov(mod), type = "means"))
cat("\n")
}
}
return(anova_mod)
}
)

0 comments on commit c2bebb2

Please sign in to comment.