factorH provides a simple, single-call workflow for multifactor nonparametric, rank-based ANOVA and publication-ready outputs:
ranks (rooted in Kruskal-Wallis H and the 2x2 Scheirer-Ray-Hare extension),simple-effects post hocs (pairwise comparisons within levels
of conditioning factors),
compact descriptive tables and a TSV writer for quick formatting in Excel or a manuscript.
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))
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 to a tab-separated file
f <- tempfile(fileext = ".tsv")
write.srh.kway.full.tsv(res3, file = f, dec = ".") # decimal dot
file.exists(f)
If you need comma as decimal mark:
f2 <- tempfile(fileext = ".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.
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().
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.