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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Aug 23 10:45:31 CEST 2012


Author: jarioksa
Date: 2012-08-23 10:45:31 +0200 (Thu, 23 Aug 2012)
New Revision: 2258

Modified:
   pkg/vegan/R/betadisper.R
   pkg/vegan/inst/ChangeLog
Log:
C API to double centring was removed in R-devel r60360, and we substitute an R function

Modified: pkg/vegan/R/betadisper.R
===================================================================
--- pkg/vegan/R/betadisper.R	2012-08-23 06:21:08 UTC (rev 2257)
+++ pkg/vegan/R/betadisper.R	2012-08-23 08:45:31 UTC (rev 2258)
@@ -1,6 +1,16 @@
 `betadisper` <-
     function(d, group, type = c("median","centroid"), bias.adjust=FALSE)
 {
+    ## inline function for double centring. We used .C("dblcen", ...,
+    ## PACKAGE = "stats") which does not dublicate its argument, but
+    ## it was removed from R in r60360 | ripley | 2012-08-22 07:59:00
+    ## UTC (Wed, 22 Aug 2012) "more conversion to .Call, clean up".
+    dblcen <- function(x, na.rm = TRUE) {
+        cnt <- colMeans(x, na.rm = na.rm)
+        x <- sweep(x, 2L, cnt, check.margin = FALSE)
+        cnt <- rowMeans(x, na.rm = na.rm)
+        sweep(x, 1L, cnt, check.margin = FALSE)
+    }
     ## inline function for spatial medians
     spatialMed <- function(vectors, group, pos) {
         axes <- seq_len(NCOL(vectors))
@@ -60,7 +70,7 @@
     }
     x <- x + t(x)
     storage.mode(x) <- "double"
-    .C("dblcen", x, as.integer(n), DUP = FALSE, PACKAGE="stats")
+    x <- dblcen(x)
     e <- eigen(-x/2, symmetric = TRUE)
     vectors <- e$vectors
     eig <- e$values

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2012-08-23 06:21:08 UTC (rev 2257)
+++ pkg/vegan/inst/ChangeLog	2012-08-23 08:45:31 UTC (rev 2258)
@@ -3,6 +3,13 @@
 VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
 
 Version 2.1-19 (opened August 20, 2012)
+
+	* betadisper: An effective R stats .C function was used for double
+	centring, but it was removed from the API in r60360 | ripley |
+	2012-08-22 07:59:00 UTC (Wed, 22 Aug 2012). This removal stopped
+	betadisper() with error. Now we have a less efficient R code for
+	the same purpose. However, the effects in timing should be
+	negligible.
  
 	* density methods: all vegan functions that return simulated or
 	permuted statistics have now density() methods that directly



More information about the Vegan-commits mailing list