Skip to contents

Automatically selects and generates the most appropriate statistical visualization based on variable data types. Features enhanced error messages with contextual guidance, robust data validation, and comprehensive fallback options. Supports both independent and repeated measures designs with various plot types including violin plots, scatter plots, bar charts, and alluvial diagrams.

Usage

statsplot2(
  data,
  dep = NULL,
  group = NULL,
  grvar = NULL,
  direction = "independent",
  distribution = "p",
  alluvsty = "t1",
  excl = FALSE,
  sampleLarge = FALSE,
  sampleThreshold = 10000,
  sampleSize = 5000,
  seed = 42
)

Arguments

data

The data as a data frame.

dep

The dependent variable (y-axis, 1st measurement). Can be continuous or categorical.

group

The grouping variable (x-axis, 2nd measurement). Can be continuous or categorical.

grvar

Optional grouping variable for creating grouped plots across multiple panels.

direction

Measurement design type. "independent" for between-subjects comparisons, "repeated" for within-subjects/repeated measures comparisons.

distribution

Statistical approach: "p" = parametric, "np" = nonparametric, "r" = robust, "bf" = Bayes factor.

alluvsty

Style for alluvial diagrams: "t1" = ggalluvial with stratum labels, "t2" = easyalluvial with automatic variable selection.

excl

If TRUE, excludes rows with missing values before analysis.

sampleLarge

If TRUE, automatically samples large datasets (>10,000 rows) to 5,000 rows for improved performance.

sampleThreshold

Row count above which sampling is applied, when 'Sample large datasets' is enabled. Datasets at or below this size are always analysed in full.

sampleSize

Number of rows to retain when sampling. Larger values keep more statistical power at the cost of plotting speed. Statistics are computed on the retained rows only.

seed

Random seed for the reproducible sampling of large datasets (used when 'Sample Large Datasets' is enabled). Change it to draw a different sample; the default (42) reproduces the previous fixed behaviour.

Value

A results object containing:

results$noticesa preformatted
results$todoa html
results$ExplanationMessagea html
results$plotan image