Learn R Programming

easynem (version 1.0.3)

KruskalTest: Perform Kruskal-Wallis test on easynem meta-table by treatment (single factor)

Description

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

Usage

KruskalTest(data, .group, y, exact=FALSE, sort=TRUE, .method=c("holm",
"hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none"), ...)

Value

An compare-class object.

Arguments

data

An easynem-class data.

.group

Grouping variables.

y

Dependent variable (numeric data).

exact

logical. If TRUE, calculate exact Wilcoxon tests. Default exact = FALSE.

sort

logical. If TRUE, sort groups by median dependent variable values. Default sort = TRUE.

.method

method for correcting p-values for multiple comparisons.

...

Other parameters for kruskal.test.

Details

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

nem_compare <- nem |> calc_compare(.group = con_crop, y = pH, method = KruskalTest)

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, KruskalTest2, LSD, LSD2, HSD, HSD2.

Examples

Run this code
nem <- read_nem2(tab = nemtab, tax = nemtax, meta = nemmeta)
nem_test <- nem |>
            calc_compare(.group = Treatments,
              y = Mesorhabditis,
              method = KruskalTest)
nem_test

Run the code above in your browser using DataLab