[Vegan-commits] r2272 - in branches/2.0: R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Sep 10 08:58:43 CEST 2012


Author: jarioksa
Date: 2012-09-10 08:58:43 +0200 (Mon, 10 Sep 2012)
New Revision: 2272

Modified:
   branches/2.0/R/betadisper.R
   branches/2.0/inst/ChangeLog
Log:
merge r2258: protect betadisper against changes in R-devel

Modified: branches/2.0/R/betadisper.R
===================================================================
--- branches/2.0/R/betadisper.R	2012-09-05 15:42:49 UTC (rev 2271)
+++ branches/2.0/R/betadisper.R	2012-09-10 06:58:43 UTC (rev 2272)
@@ -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: branches/2.0/inst/ChangeLog
===================================================================
--- branches/2.0/inst/ChangeLog	2012-09-05 15:42:49 UTC (rev 2271)
+++ branches/2.0/inst/ChangeLog	2012-09-10 06:58:43 UTC (rev 2272)
@@ -4,6 +4,7 @@
 
 Version 2.0-5 (opened June 18, 2012)
 
+	* merge r2258: protect betadisper against changes in R-devel API.
 	* merge r2254: stylistic in examples of Rd files.
 	* merge r2250: do not use paste0 in envift.Rd (fails in R 2.14).
 	* merge r2249: fix vignette building with TeXLive 2012.



More information about the Vegan-commits mailing list