calc_compare2: Multiple comparisons between treatments (two-factor)

View source: R/calc_compare2.R

calc_compare2R Documentation

Multiple comparisons between treatments (two-factor)

Description

The calc_compare2 is used for multiple comparisons between different treatments and create compare2-class. This function is only applicable to two-factor analysis, see calc_compare for a single factor version of the function.

Usage

calc_compare2(data, .group1, .group2, y, method, ...)

Arguments

data

An easynem-class data.

.group1

Grouping variables factor 1 (supports only two groups).

.group2

Grouping variables factor 1 (supports only two groups).

y

Dependent variable (numeric data).

method

The method of difference comparison. Such as TTest, TTest2, WilcoxTest, WilcoxTest2, KruskalTest, KruskalTest2, LSD, LSD2, HSD, HSD2, etc.

...

Other parameters for t.test.

Details

To facilitate code interpretation, it is recommended to use the pipe symbol |> to connect functions:

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

Value

An compare2-class object.

See Also

Other functions in this R package for data calculations: calc_beta, calc_beta2, calc_compare, calc_alpha, calc_nemindex, calc_funguild, calc_funguild2, calc_mf, calc_mf2, calc_ter, calc_ter2, calc_ef, calc_ef2.

Examples

nem <- read_nem(tab = easynem_example("nemtab1.csv"),
                tax = easynem_example("nemtax1.csv"),
                meta = easynem_example("nemmeta1.csv"))
nem_ttest <- nem |>
              filter_name(meta, con_crop %in% c("Y2", "Y11")) |>
              calc_compare2(.group1 = con_crop, .group2 = season, y = pH, method = TTest2)
nem_ttest

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