R Vegan package: Excluding NA values from permanova (adonis)

Viewed 617

I am trying to generate PERMANOVAS using the adonis function from the vegan package. I am testing many different factors to see which ones are significant. For certain factors in my metadata some samples are NA. Obviously when I try to generate a permanova for these factors, I get an error. I don't want to remove rows that have NA values from the dataset because they are only in certain columns, and I would like to include these samples for analysis of other factors. I also do not want to fill the NA columns with another value (ie 0) because this may effect the results. I am looking for a way to exclude the values that are NA when generating each permanova.

I tried both

propData<-as.data.frame(t(otu_table(otu)))
propData_bray<-vegdist(propData, "bray")

adonis(formula = propData_bray ~ pH, data=new_meta, na.action=na.exclude)

and

adonis(formula = propData_bray ~ pH, data=new_meta, na.action=na.omit)

The otu table has no NA values. Here is an example of the metadata:

sample factorA factorB factorC factorD
1 yes 3 NA 0.5
2 yes 4 no 1
3 no NA yes 0.05
4 yes 3 yes 0.7
5 NA 0 NA 1.5

for factorA I would include samples 1-4, factorB 1-2 & 4-5 , etc.

0 Answers
Related