[Vegan-commits] r2037 - pkg/vegan/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 6 08:49:48 CET 2012


Author: jarioksa
Date: 2012-01-06 08:49:47 +0100 (Fri, 06 Jan 2012)
New Revision: 2037

Modified:
   pkg/vegan/R/plot.cca.R
Log:
more checks against users requesting non-existing scores

Modified: pkg/vegan/R/plot.cca.R
===================================================================
--- pkg/vegan/R/plot.cca.R	2012-01-05 08:58:12 UTC (rev 2036)
+++ pkg/vegan/R/plot.cca.R	2012-01-06 07:49:47 UTC (rev 2037)
@@ -4,7 +4,7 @@
 {
     TYPES <- c("text", "points", "none")
     g <- scores(x, choices, display, scaling, const)
-    if (length(g) == 0)
+    if (length(g) == 0 || all(is.na(g)))
       stop("nothing to plot: requested scores do not exist")
     if (!is.list(g)) 
         g <- list(default = g)
@@ -56,6 +56,8 @@
     if (missing(xlim))
         xlim <- range(g$spe[, 1], g$sit[, 1], g$con[, 1], g$default[,1],
                       na.rm = TRUE)
+    if (!any(is.finite(xlim)))
+        stop("no finite scores to plot")
     if (missing(ylim))
         ylim <- range(g$spe[, 2], g$sit[, 2], g$con[, 2], g$default[,2],
                       na.rm = TRUE)



More information about the Vegan-commits mailing list