| reportggstatsplotPostHoc | R Documentation |
This function extracts significant pairwise comparisons from a ggstatsplot object,
calculates the mean and standard deviation for the groups involved using the raw data,
and prints LaTeX-formatted sentences reporting the results.
reportggstatsplotPostHoc(
data,
p,
iv = "testiv",
dv = "testdv",
label_mappings = NULL
)
data |
A data frame containing the raw data used to generate the plot. |
p |
A |
iv |
Character string. The column name of the independent variable (grouping variable). |
dv |
Character string. The column name of the dependent variable. |
label_mappings |
Optional named list or vector. Used to rename factor levels in the output text
(e.g., |
No return value. The function prints LaTeX-formatted text to the console.
To easily copy and paste the results to your manuscript, the following commands
(or similar) must be defined in your LaTeX preamble, as the function outputs
commands taking arguments (e.g., \m{value}):
\newcommand{\m}[1]{\textit{M}=#1}
\newcommand{\sd}[1]{\textit{SD}=#1}
\newcommand{\padj}[1]{$p_{adj}=#1$}
\newcommand{\padjminor}[1]{$p_{adj}<#1$}
library(ggstatsplot)
library(dplyr)
# Generate a plot
plt <- ggbetweenstats(mtcars, am, mpg)
# Report stats
reportggstatsplotPostHoc(
data = mtcars,
p = plt,
iv = "am",
dv = "mpg",
label_mappings = list("0" = "Automatic", "1" = "Manual")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.