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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Sep 22 19:18:01 CEST 2011


Author: psolymos
Date: 2011-09-22 19:18:01 +0200 (Thu, 22 Sep 2011)
New Revision: 1874

Modified:
   pkg/vegan/R/nullmodel.R
Log:
round to nearest integer before forcing integer mode

Modified: pkg/vegan/R/nullmodel.R
===================================================================
--- pkg/vegan/R/nullmodel.R	2011-09-22 15:05:46 UTC (rev 1873)
+++ pkg/vegan/R/nullmodel.R	2011-09-22 17:18:01 UTC (rev 1874)
@@ -19,8 +19,10 @@
     int <- method$mode == "integer"
     if (int && abs(sum(x) - sum(as.integer(x))) > 10^-6)
         stop("non integer values not allowed")
-    if (int)
+    if (int) {
+        x <- round(x, 0) # round up to closest integer
         storage.mode(x) <- "integer"
+    }
     out <- list(
         data=x,
         nrow=as.integer(dim(x)[1L]),



More information about the Vegan-commits mailing list