We had a short discussion on Mattermost about it.
Currently in the chapter on the community
similarity,
we use getPERMANOVA function to output it into a separate object. We can also
use addPERMANOVA() function to add it directly to metadata of TreeSE (see
docs):
tse <- addPERMANOVA(
tse,
assay.type = "relabundance",
method = "bray",
formula = x ~ SampleType,
permutations = 99
)
# The results are stored to metadata
metadata(tse)[["permanova"]]
We can rewrite that part by using addPERMANOVA().
For my own project I wrote this function, which can be used to output the
final table in Quarto document.
library(mia)
library(janitor)
library(tidyverse)
library(knitr)
library(kableExtra)
outputFullPermanova <- function(x) {
x$permanova |>
as.data.frame() |>
slice(1:3) |>
rename(p_val = "Pr(>F)") |>
cbind(
x$homogeneity |>
rename("p_homogeneity" = "Pr(>F)")
) |>
clean_names() |>
rownames_to_column("variable") |>
select(variable, r2, p_val, p_homogeneity) |>
mutate(
variable = str_to_title(variable)
) |>
kable(
digits = 3,
row.names = FALSE,
booktabs = TRUE,
col.names = c("Variable", "R2", "P", "P Homogeneity")
) |>
kable_styling(latex_options = c("hold_position", "striped"), font_size = 8)
}
We had a short discussion on Mattermost about it.
Currently in the chapter on the community
similarity,
we use
getPERMANOVAfunction to output it into a separate object. We can alsouse
addPERMANOVA()function to add it directly tometadataof TreeSE (seedocs):
We can rewrite that part by using
addPERMANOVA().For my own project I wrote this function, which can be used to output the
final table in Quarto document.