Check the data's distribution. If non-normal, take the non-parametric variant of ggwithinstats. x and y have to be in parentheses, e.g., "ConditionID". Add Asterisks instead of p-values.
Source:R/plotting.R, R/zzz-aliases.R
ggwithinstatsWithPriorNormalityCheckAsterisk.RdCheck the data's distribution. If non-normal, take the non-parametric variant of ggwithinstats. x and y have to be in parentheses, e.g., "ConditionID". Add Asterisks instead of p-values.
Usage
ggwithinstatsWithPriorNormalityCheckAsterisk(
data,
x,
y,
ylab,
xlabels,
plotType = "boxviolin"
)
plot_within_stats_asterisk(data, x, y, ylab, xlabels, plotType = "boxviolin")Value
A ggplot object produced by ggstatsplot::ggwithinstats
with additional significance annotations, which can be printed or modified.
Naming
plot_within_stats_asterisk() is the spelling used throughout the documentation and
the one to prefer in new code: the report_* / plot_* / check_* prefixes
make the API discoverable through autocomplete.
ggwithinstatsWithPriorNormalityCheckAsterisk() is the original
name. Both names refer to the same function object, so they are entirely
interchangeable; the original remains fully supported and is not scheduled
for removal, and existing scripts keep working unchanged.
Examples
# \donttest{
set.seed(123)
# Toy within-subject style data
main_df <- data.frame(
Participant = factor(rep(1:20, each = 3)),
CondID = factor(rep(c("A", "B", "C"), times = 20)),
tlx_mental = rnorm(60, mean = 50, sd = 10)
)
# Custom x-axis labels
labels_xlab <- c("Condition A", "Condition B", "Condition C")
ggwithinstatsWithPriorNormalityCheckAsterisk(
data = main_df,
x = "CondID", y = "tlx_mental",
ylab = "Mental Demand", xlabels = labels_xlab
)
#> Scale for x is already present.
#> Adding another scale for x, which will replace the existing scale.
# }