trans_alpha {microeco}R Documentation

Create trans_alpha object for alpha diveristy statistics and plotting.

Description

This class is a wrapper for a series of alpha diveristy related analysis, including the statistics and plotting based on An et al. (2019) <doi:10.1016/j.geoderma.2018.09.035> and Paul et al. (2013) <doi:10.1371/journal.pone.0061217>.

Methods

Public methods


Method new()

Usage
trans_alpha$new(dataset = NULL, group = NULL, order_x = NULL)
Arguments
dataset

the object of microtable Class.

group

default NULL; the sample column used for the statistics; If provided, can return alpha_stat.

order_x

default:null; sample_table column name or a vector containg sample names; if provided, make samples ordered by using factor.

Returns

alpha_data and alpha_stat stored in the object.

Examples
data(dataset)
t1 <- trans_alpha$new(dataset = dataset, group = "Group")

Method cal_diff()

Test the difference of alpha diveristy across groups. If use anova, require agricolae package.

Usage
trans_alpha$cal_diff(method = c("KW", "anova")[1], measures = NULL)
Arguments
method

default "KW"; "KW" or "anova"; KW rank sum test or anova for the testing.

measures

default NULL; a vector; if null, all indexes will be calculated; see names of alpha_diversity of dataset, e.g. Observed, Chao1, ACE, Shannon, Simpson, InvSimpson, Fisher, Coverage, PD.

Returns

res_alpha_diff in object.

Examples
t1$cal_diff(method = "KW")
t1$cal_diff(method = "anova")

Method plot_alpha()

Plotting the alpha diveristy.

Usage
trans_alpha$plot_alpha(
  color_values = RColorBrewer::brewer.pal(8, "Dark2"),
  measure = "Shannon",
  group = NULL,
  add_letter = FALSE,
  pair_compare = FALSE,
  pair_compare_filter = "",
  pair_compare_method = "wilcox.test",
  xtext_type = NULL,
  xtext_size = 10,
  ytitle_size = 17,
  base_font = NULL,
  ...
)
Arguments
color_values

colors used for presentation.

measure

default Shannon; alpha diveristy measurement; see names of alpha_diversity of dataset, e.g. Observed, Chao1, ACE, Shannon, Simpson, InvSimpson, Fisher, Coverage, PD.

group

default NULL; group name used for the plot.

add_letter

default FALSE; If TRUE, the letters of duncan test will be added in the plot.

pair_compare

default FALSE; whether perform paired comparisons.

pair_compare_filter

default ""; groups that will be removed.

pair_compare_method

default wilcox.test; wilcox.test, kruskal.test, t.test or anova.

xtext_type

default NULL; number used to make x axis text generate angle.

xtext_size

default 10, x axis text size.

ytitle_size

default 17, y axis title size.

base_font

default NULL, font in the plot.

...

parameters pass to ggpubr::ggboxplot.

Returns

ggplot.

Examples
t1$plot_alpha(color_values = RColorBrewer::brewer.pal(12, "Paired"), measure = "Shannon", 
  group = "Group", pair_compare = TRUE)

Method print()

Print the trans_alpha object.

Usage
trans_alpha$print()

Method clone()

The objects of this class are cloneable with this method.

Usage
trans_alpha$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `trans_alpha$new`
## ------------------------------------------------

data(dataset)
t1 <- trans_alpha$new(dataset = dataset, group = "Group")

## ------------------------------------------------
## Method `trans_alpha$cal_diff`
## ------------------------------------------------

t1$cal_diff(method = "KW")
t1$cal_diff(method = "anova")

## ------------------------------------------------
## Method `trans_alpha$plot_alpha`
## ------------------------------------------------

t1$plot_alpha(color_values = RColorBrewer::brewer.pal(12, "Paired"), measure = "Shannon", 
  group = "Group", pair_compare = TRUE)

[Package microeco version 0.2.1 Index]