swilk: Shapiro-Wilk normality test

View source: R/normality.R

swilkR Documentation

Shapiro-Wilk normality test

Description

Runs Shapiro-Wilk tests overall, for many variables, and/or within hierarchical groups. Each tested subgroup must have enough complete observations for the Shapiro-Wilk procedure.

Usage

swilk(x = NULL,
  vars = NULL,
  by = NULL,
  data = NULL,
  digits = 4,
  p_digits = 3,
  show = TRUE,
  console = FALSE)

Arguments

x

One numeric variable; may be omitted when vars is supplied.

vars

Optional vars(...) selection of several numeric variables.

by

Optional hierarchical grouping specification. The final variable in vars(...) is the innermost group and preceding variables are strata.

data

Data frame; active R4VN data is used when omitted.

digits, p_digits

Formatting digits.

show, console

R4VN display controls.

Value

An R4VN result object, invisibly.

See Also

normtest, varform

Examples

d <- data.frame(x = rnorm(40), y = rnorm(40), group = rep(c("A", "B"), each = 20))
swilk(x, data = d)
swilk(vars = vars(x, y), data = d)
swilk(vars = vars(x, y), by = vars(group), data = d)


R4VN documentation built on Sept. 30, 2026, 5:13 p.m.