nonpar.datatable: Compact descriptive tables (APA-style) with global rank means

View source: R/nonpar.datatable.R

nonpar.datatableR Documentation

Compact descriptive tables (APA-style) with global rank means

Description

Produces descriptive statistics for all main effects and interaction cells implied by the RHS of formula. Ranks are computed globally (across all observations) and cell-wise mean ranks are reported (recommended for interpreting rank-based factorial effects).

Usage

nonpar.datatable(formula, data, force_factors = TRUE)

Arguments

formula

A formula of the form y ~ A (+ B + ...).

data

A data.frame containing y and the grouping factors.

force_factors

Logical; coerce grouping variables to factor (default TRUE).

Details

The function first subsets to complete cases on y and all RHS factors, then computes global ranks of y (ties.method = "average"). For each effect (every non-empty combination of factors up to full order), it returns a row per cell with: count, mean, sd, median, quartiles (q1, q3), IQR, and mean_rank. The column Effect identifies the effect (e.g., "A", "B", "A:B"). Missing factor columns for a given effect are added with NA values but retain the proper factor levels for easy binding.

Value

A base data.frame with columns:

  • Effect (character),

  • factor columns for all RHS factors (factors, possibly NA in some rows),

  • count, mean, sd, median, q1, q3, IQR, mean_rank.

The original call is attached as attribute "call".

Examples

data(mimicry, package = "factorH")

# One factor
nonpar.datatable(liking ~ condition, data = mimicry)

# Two factors: rows for gender, for condition, and for gender:condition
nonpar.datatable(liking ~ gender + condition, data = mimicry)

# Three factors: all mains + 2-way and 3-way cells
nonpar.datatable(liking ~ gender + condition + age_cat, data = mimicry)


factorH documentation built on Sept. 11, 2025, 9:09 a.m.