Hello, just for visualization, I want to plot the centroids of a PCoA (or an NMDS) from a multivariate dataset that comes from two-factorial experiment desing. That is, I have lab based microbial community data (relative abundances) coming from an experiment following a two factorial design.
I plotted all the data using ggplot by extracting the coordinates of the first two axis using the scores function. But to simplify it, I would like to see only the centroids per treatment combination. Using envfit I get the centroids for each "main" factor:
Hello, just for visualization, I want to plot the centroids of a PCoA (or an NMDS) from a multivariate dataset that comes from two-factorial experiment desing. That is, I have lab based microbial community data (relative abundances) coming from an experiment following a two factorial design.
I plotted all the data using ggplot by extracting the coordinates of the first two axis using the
scores
function. But to simplify it, I would like to see only the centroids per treatment combination. Using envfit I get the centroids for each "main" factor:en_pco <-envfit(spec.pco~Treatment, data= OTU_abundance6, permutations = 999, na.rm = TRUE)
en_pco$factors$centroids
But, I realize that these centroids are actually means of the first two axis:
temp_pco %>% group_by(Treatment) %>% summarise_at(c("Dim1","Dim2"),mean)
This would mean that one could just calculate the mean per treatment combination on the two axis to get the centroids per group, right?
Sth like:
temp_pco %>% group_by(Treatment,Plant) %>% summarise_at(c("Dim1","Dim2"),mean)