# NOT RUN {
# time consuming, so not run on `CRAN` machines
# }
# NOT RUN {
# show all columns in a tibble
options(tibble.width = Inf)
# for reproducibility
set.seed(123)
#------------------- between-subjects design ----------------------------
# parametric
# if `var.equal = TRUE`, then Student's *t*-test will be run
ggstatsplot::pairwise_p(
  data = ggplot2::msleep,
  x = vore,
  y = brainwt,
  type = "p",
  var.equal = TRUE,
  paired = FALSE,
  p.adjust.method = "bonferroni"
)
# if `var.equal = FALSE`, then Games-Howell test will be run
ggstatsplot::pairwise_p(
  data = ggplot2::msleep,
  x = vore,
  y = brainwt,
  type = "p",
  var.equal = FALSE,
  paired = FALSE,
  p.adjust.method = "bonferroni"
)
# non-parametric
ggstatsplot::pairwise_p(
  data = ggplot2::msleep,
  x = vore,
  y = brainwt,
  type = "np",
  paired = FALSE,
  p.adjust.method = "none"
)
# robust
ggstatsplot::pairwise_p(
  data = ggplot2::msleep,
  x = vore,
  y = brainwt,
  type = "r",
  paired = FALSE,
  p.adjust.method = "fdr"
)
# }
# NOT RUN {
#------------------- within-subjects design ----------------------------
set.seed(123)
library(jmv)
data("bugs", package = "jmv")
# converting to long format
bugs_long <- bugs %>%
  tibble::as_tibble(.) %>%
  tidyr::gather(., key, value, LDLF:HDHF)
# parametric
ggstatsplot::pairwise_p(
  data = bugs_long,
  x = key,
  y = value,
  type = "p",
  paired = TRUE,
  p.adjust.method = "BH"
)
# non-parametric
ggstatsplot::pairwise_p(
  data = bugs_long,
  x = key,
  y = value,
  type = "np",
  paired = TRUE,
  p.adjust.method = "BY"
)
# robust
ggstatsplot::pairwise_p(
  data = bugs_long,
  x = key,
  y = value,
  type = "r",
  paired = TRUE,
  p.adjust.method = "hommel"
)
# }
Run the code above in your browser using DataLab