KruskalTest2: Perform Kruskal-Wallis test on easynem meta-table by...

View source: R/KruskalTest2.R

KruskalTest2R Documentation

Perform Kruskal-Wallis test on easynem meta-table by treatment (two-factor)

Description

The KruskalTest2() is used to perform Kruskal-Wallis test for grouped data and create compare2-class. This function is only applicable to two-factor analysis, see KruskalTest for a single factor version of the function.

Usage

KruskalTest2(data, .group1, .group2, y, p.adj = "none", ...)

Arguments

data

An easynem-class data.

.group1

Grouping variables factor 1.

.group2

Grouping variables factor 2.

y

Dependent variable (numeric data).

p.adj

method for correcting p-values for multiple comparisons. Default p.adj = "none".

...

Other parameters for kruskal.test.

Details

To facilitate code interpretation, It is recommended to use this function in conjunction with the calc_compare2 function:

nem_compare <- nem |> calc_compare2(.group1 = con_crop, .group2 = season, y = pH, method = KruskalTest)

Value

An compare2-class object.

References

R in Action: Data Analysis and Graphics with R, Second Edition by Robert I. Kabacoff, published by Manning Publications. 178 South Hill Drive, Westampton, NJ 08060 USA. Copyright 2015 by Manning Publications.

See Also

Other functions related to differential analysis methods: TTest2, TTest, WilcoxTest2, WilcoxTest, KruskalTest, LSD, LSD2, HSD, HSD2.

Examples

nem <- read_nem(tab = easynem_example("nemtab1.csv"),
                tax = easynem_example("nemtax1.csv"),
                meta = easynem_example("nemmeta1.csv"))
nem_test <- nem |>
              calc_compare2(.group1 = con_crop, .group2 = season, y = pH, method = KruskalTest2)
nem_test

easynem documentation built on Nov. 5, 2025, 7:39 p.m.