trans_alpha {microeco} | R Documentation |
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>.
new()
trans_alpha$new(dataset = NULL, group = NULL, order_x = NULL)
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.
alpha_data and alpha_stat stored in the object.
data(dataset) t1 <- trans_alpha$new(dataset = dataset, group = "Group")
cal_diff()
Test the difference of alpha diveristy across groups. If use anova, require agricolae package.
trans_alpha$cal_diff(method = c("KW", "anova")[1], measures = NULL)
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.
res_alpha_diff in object.
t1$cal_diff(method = "KW") t1$cal_diff(method = "anova")
plot_alpha()
Plotting the alpha diveristy.
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, ... )
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.
ggplot.
t1$plot_alpha(color_values = RColorBrewer::brewer.pal(12, "Paired"), measure = "Shannon", group = "Group", pair_compare = TRUE)
print()
Print the trans_alpha object.
trans_alpha$print()
clone()
The objects of this class are cloneable with this method.
trans_alpha$clone(deep = FALSE)
deep
Whether to make a deep clone.
## ------------------------------------------------ ## 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)