Learn R Programming

easynem (version 1.0.3)

nem_plot,compare2-method: Visualizing the results of multiple comparisons (two-factor)

Description

The nem_plot function is generalized to the compare2-class and is used to visualize the results of two-factor multiple comparisons.

Usage

# S4 method for compare2
nem_plot(object, type1 = 1, type2 = 1, add, ...)

Value

An gg or ggplot object.

Arguments

object

A compare2-class object.

type1

type1 = 1, draws a box plot; type1 = 2, draws a bar plot. Default type1 = 1.

type2

type2 = 1, draw a cluster plot; type2 = 2, draws faceted plot. Default type2 = 1.

add

Add standard deviation or standard error (only used when drawing a bar plot).

...

Other parameters to be expanded.

Details

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

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

See Also

The nem_plot() is used to visualize the calculation results and is a generalized function for multiple classes including beta-class, beta2-class, compare-class, compare2-class, ef-class, ef2-class, funguild-class, funguild2-class, mf-class, mf2-class, ter-class, ter2-class, etc.

Examples

Run this code
nem <- read_nem(tab = easynem_example("nemtab1.csv"),
                tax = easynem_example("nemtax1.csv"),
                meta = easynem_example("nemmeta1.csv"))
nem_plot <- nem |> calc_compare2(.group1 = con_crop,
                    .group2 = season, y = pH, method = LSD2) |>
                    nem_plot(type2 = 2)
nem_plot
nem_plot <- nem |> calc_compare2(.group1 = con_crop,
                    .group2 = season, y = pH, method = HSD2) |>
                    nem_plot(type1 = 2, type2 = 2, add = "mean_sd")
nem_plot

Run the code above in your browser using DataLab