Maaslin with tibbles

I’m using Maaslin 1.7.3 with tidyverse 1.3.2 (tibble 3.1.8)

When trying to use a tibble as an input dataframe (in metadata) I got the error that:

“Provided categorical metadata has fewer than 2 unique, non-NA values”

When I looked at the code it seems Maaslin uses

metadata[, i] ← as.factor(metadata[, i])

To turn a string into a factor before analysis. For a tibble this will replace the column with NAs, hence the error.

If I use as.data.frame() prior to analysis it works fine. With a tibble for main data there is a similar error, so either a warning not to use tibbles, a different way pull columns or a conversion internally to data frames is probably needed.

Great work on the package though!

Thanks for pointing this out. A fix has been pushed to the github version that checks for and converts tibble inputs as appropriate.

1 Like