Learn R Programming

easynem (version 1.0.3)

TTest2: Perform t-test on easynem meta-table by treatment (two-factor)

Description

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

Usage

TTest2(data, .group1, .group2, y, ...)

Value

An compare2-class object.

Arguments

data

An easynem-class data.

.group1

Grouping variables factor 1 (supports only two groups).

.group2

Grouping variables factor 2 (supports only two groups).

y

Dependent variable (numeric data).

...

Other parameters for t.test.

Details

Note: The t-test is only applicable to comparisons between two groups of data. 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 = TTest2)

See Also

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

Examples

Run this code
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

Run the code above in your browser using DataLab