print_anova: Print the results of an 'afex' ANOVA

View source: R/print_anova.R

print_anovaR Documentation

Print the results of an afex ANOVA

Description

Print the results of an afex ANOVA

Usage

print_anova(afex_object, italic_eta = TRUE, decimals = 2, decimals_p = 3)

Arguments

afex_object

An object returned by one of afex's ANOVA functions. See details.

italic_eta

Should the effect size symbol eta be printed in italic font. Defaults to TRUE. See details.

decimals

How many decimals should be printed for F values and eta-squared. Defaults to 2.

decimals_p

How many decimals should be printed for p-values. Defaults to 3.

Details

To use this function, you have to install the package afex to compute an ANOVA object, see aov_car. Pass this object as the first argument.

According to APA style, the _greek_ eta symbol - indicating the effect size in the ANOVA - should be printed in non-italic font. However, the standard Latex \eta symbol is italic. To print a non-italic eta, use the argument italic_eta = FALSE. However, this option requires that you load the package upgreek in the YAML header of your R markdown document. To this end, use the following option in your YAML header:

header-includes: -\usepackageupgreek

Value

A list whose elements are strings describing the ANOVA; to be included in an R markdown document.

Author(s)

Martin Papenberg martin.papenberg@hhu.de

References

Singmann, H., Bolker, B., Westfall, J., & Aust, F. (2019). afex: Analysis of Factorial Experiments. https://CRAN.R-project.org/package=afex

Examples


library("afex")
# see ?aov_ez
data(md_12.1)
aov_results <- aov_ez("id", "rt", md_12.1, within = c("angle", "noise"))
print_anova(aov_results)

# Print nonitalic eta, which is required according to APA guidelines
print_anova(aov_results, italic_eta = FALSE)

# Example using other (or no) effect size index
pes <- aov_ez("id", "rt", md_12.1, within = c("angle", "noise"),
              anova_table = list(es = "pes"))
print_anova(pes)
print_anova(pes, italic_eta = FALSE)
noes <- aov_ez("id", "rt", md_12.1, within = c("angle", "noise"),
               anova_table = list(es = "none"))
print_anova(noes)

## Access individual elements of the ANOVA print list:
aovpr <- print_anova(aov_results, italic_eta = FALSE)
# By index: 
aovpr[[1]]
# By name (main effect): 
aovpr$angle
aovpr[["angle"]]
# By name (interaction effect, here, the $-notation does not work 
# due to non-standard `:` in name): 
aovpr[["angle:noise"]] 



m-Py/prmisc documentation built on Aug. 23, 2023, 1:20 a.m.