[Vegan-commits] r2149 - in pkg/vegan: R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Apr 24 20:18:21 CEST 2012


Author: jarioksa
Date: 2012-04-24 20:18:21 +0200 (Tue, 24 Apr 2012)
New Revision: 2149

Modified:
   pkg/vegan/R/rrarefy.R
   pkg/vegan/inst/ChangeLog
Log:
drarefy & rrarefy check that input data are integers

Modified: pkg/vegan/R/rrarefy.R
===================================================================
--- pkg/vegan/R/rrarefy.R	2012-04-24 10:15:47 UTC (rev 2148)
+++ pkg/vegan/R/rrarefy.R	2012-04-24 18:18:21 UTC (rev 2149)
@@ -3,6 +3,8 @@
 `rrarefy` <-
     function(x, sample)
 {
+    if (!identical(all.equal(x, round(x)), TRUE)) 
+        stop("function is meaningful only for integers (counts)")
     x <- as.matrix(x)
     if (ncol(x) == 1)
         x <- t(x)
@@ -27,6 +29,8 @@
 `drarefy` <-
     function(x, sample)
 {
+    if (!identical(all.equal(x, round(x)), TRUE)) 
+        stop("function accepts only integers (counts)")
     if (length(sample) > 1 &&  length(sample) != nrow(x))
         stop(gettextf(
              "length of  'sample' and number of rows of 'x' do not match"))

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2012-04-24 10:15:47 UTC (rev 2148)
+++ pkg/vegan/inst/ChangeLog	2012-04-24 18:18:21 UTC (rev 2149)
@@ -3,6 +3,9 @@
 VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
 
 Version 2.1-15 (opened April 24, 2012)
+
+	* rrarefy, drarefy: check the data are integers -- the functions
+	do not give sensible results with real values.
 	
 Version 2.1-14 (opened March 9, 2012)
 



More information about the Vegan-commits mailing list