From c3a5a77a71b84f1c6a588c50352a37694a0a8b95 Mon Sep 17 00:00:00 2001 From: ElySeraidarian <167744870+ElySeraidarian@users.noreply.github.com> Date: Tue, 8 Oct 2024 01:56:01 +0900 Subject: [PATCH] Update RDA example using plotLoadings (#603) Co-authored-by: seraidarian Co-authored-by: Tuomas Borman <60338854+TuomasBorman@users.noreply.github.com> Co-authored-by: Leo Lahti Co-authored-by: Muluh <127390183+Daenarys8@users.noreply.github.com> Co-authored-by: Daenarys8 Co-authored-by: TuomasBorman Co-authored-by: TuomasBorman --- inst/pages/beta_diversity.qmd | 22 +--------------------- oma_packages/oma_packages.csv | 3 +-- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/inst/pages/beta_diversity.qmd b/inst/pages/beta_diversity.qmd index ec847f96..f8976651 100644 --- a/inst/pages/beta_diversity.qmd +++ b/inst/pages/beta_diversity.qmd @@ -607,27 +607,7 @@ how the groups tend to differ from each other in terms of community composition. ```{r plot-top-coef-anova, fig.cap = ""} -# Extract loadings for first eigenvector -rda <- reducedDim(tse2, "RDA") -rda <- attr(rda, "rda") -coef <- rda$CCA$v -coef <- coef[, 1, drop = FALSE] - -# Get the taxa with biggest weights -top_coef <- head(coef[rev(order(abs(coef))), , drop = FALSE], 20) -# Sort weights in increasing order -top_coef <- top_coef[order(top_coef), ] - -# Create data.frame -df <- data.frame( - x = top_coef, - y = factor(names(top_coef), unique(names(top_coef)))) - -# Create a plot -ggplot(df, aes(x = x, y = y)) + - geom_bar(stat = "identity") + - labs(x = "", y= "", title = "Top Taxa") + - theme_bw() +plotLoadings(tse2, "RDA", ncomponents = 2, n = 20) ``` In the example above, the largest differences between the two groups diff --git a/oma_packages/oma_packages.csv b/oma_packages/oma_packages.csv index 2b5a7962..05813846 100644 --- a/oma_packages/oma_packages.csv +++ b/oma_packages/oma_packages.csv @@ -32,7 +32,7 @@ grid gtools gsEasy igraph -kableExtra +IntegratedLearner knitr Maaslin2 mia @@ -68,7 +68,6 @@ SpiecEasi SPRING stats stringr -SuperLearner tidyverse topGO vegan