Skip to content

Commit

Permalink
Update RDA example using plotLoadings (#603)
Browse files Browse the repository at this point in the history
Co-authored-by: seraidarian <ely.seraidarian@ecole.ensicaen.fr>
Co-authored-by: Tuomas Borman <60338854+TuomasBorman@users.noreply.github.com>
Co-authored-by: Leo Lahti <leo.lahti@iki.fi>
Co-authored-by: Muluh <127390183+Daenarys8@users.noreply.github.com>
Co-authored-by: Daenarys8 <Daenarys8@users.noreply.github.com>
Co-authored-by: TuomasBorman <TuomasBorman@users.noreply.github.com>
Co-authored-by: TuomasBorman <tvborm@utu.fi>
  • Loading branch information
8 people authored Oct 7, 2024
1 parent d500034 commit c3a5a77
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
22 changes: 1 addition & 21 deletions inst/pages/beta_diversity.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions oma_packages/oma_packages.csv
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ grid
gtools
gsEasy
igraph
kableExtra
IntegratedLearner
knitr
Maaslin2
mia
Expand Down Expand Up @@ -68,7 +68,6 @@ SpiecEasi
SPRING
stats
stringr
SuperLearner
tidyverse
topGO
vegan
Expand Down

0 comments on commit c3a5a77

Please sign in to comment.