Common errors and problems

“contrasts can be applied only to factors with 2 or more levels”

This error usually arises when some model (linear model, ANOVA, PERMANOVA, etc.) has been specified wrongly. Ensure that your dependent variable/covariate has at least 2 unique levels. Use for example table() on your variable (eg. table(df$var)). Maybe you are using a wrong variable or a wrong subset.

PERMANOVA - “Non-conformable arrays”

This error arises when the distance matrix and the data.frame with the metadata variables are not matching in size. Ensure that your distance matrix and sample_data data.frame are from the same phyloseq object. The error can also arise if there are NAs in the metadata variables - solve this by subsetting the original phyloseq object such that there are no NAs in the variables of interest.

Many p-values are NA when running Differential Abundance

Differential abundance (DA) methods will return p-values as NA if there is too little data to calculate them. Often this problem arises because the ASVs (taxa) has not been filtered prior to running DA. Filter the ASVs and run the DA again.

“invalid class “sample_data” object: Sample Data must have non-zero dimensions.”

This error arises when trying to subset a phyloseq object and the resulting phyloseq object has no samples left. Ensure that variables and factor levels are spelled correctly (small/capital letters matter). Check that logicals are not oppossing, such as A==1 & A==2, which would never be TRUE.