From 23a640affa0795e6542e75efaa6aeab1154cbf11 Mon Sep 17 00:00:00 2001 From: Jari Oksanen Date: Sun, 17 Apr 2022 19:51:40 +0300 Subject: [PATCH] fisher.alpha(x, se=TRUE) is defunct since Dec 2013: can cause error fisherfit/fisher.alpha scrapped se=TRUE in CRAN release vegan 2.0-10 of Dec, 2013. If the underlying routine (uniroot in fisherfit) issues a warning, estimate_richness will trigger an Error with Fisher instead of warning. I came across with this in CRAN package microbial that stopped with error when I changed details in uniroot bracketing. Discussed in issue #1581. --- R/extend_vegan.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/extend_vegan.R b/R/extend_vegan.R index 2da390ba..ab6e82e4 100644 --- a/R/extend_vegan.R +++ b/R/extend_vegan.R @@ -1,5 +1,5 @@ ################################################################################ -# Define S3 methods for scores (originally defined by vegan-package) +# Define S3 methods for scores (originally defined by vegan-package) # to work for other ordination results # vegan:::scores.default ################################################################################ @@ -247,10 +247,10 @@ estimate_richness <- function(physeq, split=TRUE, measures=NULL){ outlist <- c(outlist, list(invsimpson = diversity(OTU, index="invsimpson"))) } if( "Fisher" %in% measures ){ - fisher = tryCatch(fisher.alpha(OTU, se=TRUE), + fisher = tryCatch(fisher.alpha(OTU), warning=function(w){ warning("phyloseq::estimate_richness: Warning in fisher.alpha(). See `?fisher.fit` or ?`fisher.alpha`. Treat fisher results with caution") - suppressWarnings(fisher.alpha(OTU, se=TRUE)[, c("alpha", "se")]) + suppressWarnings(fisher.alpha(OTU)) } ) if(!is.null(dim(fisher))){