command to tell if factor A or B determine
the distribution of bacteria in samples.
I am using Heatmap, PCoA, ANOSIM, Unifrac and Venn.
Is there a number or plot I can get to show
which factors correlate the best and drive distribution?

Try corr.axes.


Thanks, but my corr.axes using a metadata file:
group habitats
a 1
b 2
c 3
(1, 2, 3 referring to ArabeanSea, Baltimore, Belize, etc
as I understood I can’t use text in this column)
just outputs one line and not a line for each a, b, c that
I can use to find which habitat has the maximum ‘length’.
Something wrong with the metadata file?

Hi - I am happy for any suggestion on how
to make vectors with metadata using corr.axes.

If you have categorical variables then you probably want to do ANOVA/AMOVA to see whether there are community level differences between those factors. I’m not aware of how you’d calculate a correlation with a categorical variable.