speedyseq icon indicating copy to clipboard operation
speedyseq copied to clipboard

Give message/warning when subset_*() functions drop items due to NAs

Open mikemc opened this issue 4 years ago • 0 comments

(I think) subset_samples() and subset_taxa() will drop samples and taxa where the subsetting condition evaluates to NA. This is consistent with base R's subset() and dplyr's filter(), but is can be dangerous if the user is unaware. Mistakes seem especially likely when using subset_taxa(). For example, suppose you wanted to remove all ASVs classified as Chloroplast. You might try

ps.filt <- subset_taxa(ps, order != "Chloroplast")

but this would drop all taxa with order == "Chloroplast" as well as taxa where order is NA.

mikemc avatar Jul 01 '20 20:07 mikemc