factorH provides a simple, single-call workflow for multifactor nonparametric, rank-based ANOVA and publication-ready outputs:
Why? Popular GUI stats tools do not offer a ready-made, user-friendly multifactor rank-based pipeline that mirrors standard H / SRH analyses in a way that is easy for beginners. factorH aims to fill that gap with clear, R-like formula syntax and a one-command report function.
The package is intentionally small: most users will only ever need:
All high-level functions use standard R model formulas:
response ~ factorA + factorB + factorC
lists main effects - interactions are handled
internally. You do not need to write A:B or A*B. The
response (left of ~) must be numeric (e.g., a
Likert score coded as 1..5 stored as numeric).
Examples below use the included dataset mimicry.
library(factorH)
data(mimicry, package = "factorH")
str(mimicry)
Predictors should be factors. If not, functions will coerce them.
What is allowed?
# One factor (KW-style):  
  liking ~ condition
# Two factors (SRH-style):  
  liking ~ gender + condition
# Three or more factors (k-way):  
  liking ~ gender + condition + age_cat
You do not need to write gender:condition or
gender*condition. The package will build all needed interactions
internally when relevant.
The response must be numeric. For Likert-type items
(e.g., 1 = strongly disagree … 5 = strongly agree), keep them numeric;
rank-based tests are robust for such ordinal-like data.
If your Likert is accidentally a factor or
character, coerce safely:
# if stored as character "1","2",...:
mimicry$liking <- as.numeric(mimicry$liking)
# if stored as factor with labels "1","2",...:
mimicry$liking <- as.numeric(as.character(mimicry$liking))
Most users can cover assumption checks with a single command:
  diag_out <- plan.diagnostics(response ~ factorA + factorB (+ factorC ...), data = your_data)
What it does:
The main function srh.kway.full() runs:
For 2 factors:
res2 <- srh.kway.full(liking ~ gender + condition, data = mimicry)
names(res2)
res2$anova
head(res2$summary)
names(res2$posthoc_cells)
names(res2$posthoc_simple)[1:4]
For 3 factors:
res3 <- srh.kway.full(liking ~ gender + condition + age_cat, data = mimicry)
res3$anova
Export full result to a tab-separated file
# you can of course provide your own path to the file outside the temporary folder
f <- file.path(tempdir(), "result.tsv")
write.srh.kway.full.tsv(res3, file = f, dec = ".") # decimal dot
file.exists(f)
If you need comma as decimal mark:
f <- file.path(tempdir(), "result.tsv")
write.srh.kway.full.tsv(res3, file = f2, dec = ",") # decimal comma
file.exists(f2)
The TSV contains clearly separated sections:
## SRH: EFFECTS TABLE, ## SUMMARY STATS, ## POSTHOC CELLS, ## SIMPLE
EFFECTS, ## META. and can be easily pasted into the any equivalent Excel
or Google spreadsheets.
mimicry is a real study on the chameleon effect
(Trzmielewska, Duras, Juchacz & Rak, 2025): how
mimicry vs other movement conditions
affect liking of an interlocutor. Potential moderators
include gender and age (with dichotomized
age_cat, and a 3-level age_cat2). This makes it a natural playground for
multifactor rank-based analyses.
table(mimicry$condition)
table(mimicry$gender)
table(mimicry$age_cat)
simple-effects pairwise comparisons within
levels of conditioning factors (SPSS-like “within” scope by
default).That is it. For most users, the intro ends here: use srh.kway.full() and export with write.srh.kway.full.tsv().
C:116060334b62-intro.R