varform: Explore transformations of continuous variables

varformR Documentation

Explore transformations of continuous variables

Description

Compares the nine Tukey ladder transformations using histograms with fitted normal curves and reports n, mean, SD, median, range, skewness, kurtosis and Shapiro-Wilk diagnostics.

Usage

varform(x = NULL,
  vars = NULL,
  data = NULL,
  by = NULL,
  shift = c("none",
    "auto"),
  bins = "Sturges",
  color = NULL,
  palette = "default",
  alpha = 0.8,
  normal_color = "black",
  normal_lty = 1,
  normal_lwd = 2,
  theme = "journal",
  size = 10,
  file = NULL,
  width = 9,
  height = 8,
  dpi = 300,
  show = TRUE,
  bg = "white",
  digits = 3,
  p_digits = 3)

Arguments

x

One numeric variable; optional when vars is supplied.

vars

Optional selection of several numeric variables.

data

Data frame or active R4VN data.

by

Optional grouping specification. All selected grouping combinations receive their own transformation ladder.

shift

Whether to leave nonpositive data unchanged or add the minimum positive shift required for log/reciprocal transformations.

bins

Histogram break specification.

color, palette, alpha

Histogram appearance.

normal_color, normal_lty, normal_lwd

Normal-curve appearance.

theme, size

Graph theme and text size.

file, width, height, dpi, show, bg

Graph export/display controls. Multiple outputs receive numbered file names.

digits, p_digits

Formatting digits.

Details

The transformation ladder contains cubic, square, identity, square-root, logarithm, inverse square-root, inverse, inverse-square and inverse-cubic transformations. Logarithmic and reciprocal transformations require positive values unless shift = "auto".

Value

An R4VN result object, invisibly.

See Also

ghist, normtest

Examples

d <- data.frame(weight = c(29,26,13,23,23,25,17,22,17,19,12,26,30,30,18,14,12,26,17,18))
varform(weight, data = d)
varform(vars = vars(weight), data = d, shift = "auto")


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