david-barnett / microViz

R package for microbiome data visualization and statistics. Uses phyloseq, vegan and the tidyverse. Docker image available.
https://david-barnett.github.io/microViz/
GNU General Public License v3.0
94 stars 10 forks source link

Error: if (any(test_matrix < 1 & test_matrix != 0)) {: missing value where TRUE/FALSE needed #109

Closed david-barnett closed 1 year ago

david-barnett commented 1 year ago

NAs in otu_table are not handled informatively by ps_counts and any functions that call ps_counts, e.g. comp_barplot Instead, an uninformative error is thrown.

library(phyloseq)
library(microViz)
#> microViz version 0.10.7 - Copyright (C) 2022 David Barnett
#> ! Website: https://david-barnett.github.io/microViz
#> ✔ Useful?  For citation details, run: `citation("microViz")`
#> ✖ Silence? `suppressPackageStartupMessages(library(microViz))`
data("GlobalPatterns")
GlobalPatterns %>% tax_fix() %>% comp_barplot("Class")
#> Registered S3 method overwritten by 'seriation':
#>   method         from 
#>   reorder.hclust vegan

GlobalPatterns@otu_table[GlobalPatterns@otu_table == 0] <- NA
GlobalPatterns %>% tax_fix() %>% comp_barplot("Class")
#> Error in if (any(test_matrix < 1 & test_matrix != 0)) {: missing value where TRUE/FALSE needed

Created on 2023-03-08 with reprex v2.0.2

david-barnett commented 1 year ago

fixed in 0.10.9