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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Sep 5 21:19:52 CEST 2011


Author: jarioksa
Date: 2011-09-05 21:19:50 +0200 (Mon, 05 Sep 2011)
New Revision: 1792

Modified:
   pkg/vegan/R/anosim.R
   pkg/vegan/R/initMDS.R
   pkg/vegan/R/mantel.R
   pkg/vegan/R/mantel.partial.R
   pkg/vegan/R/mso.R
   pkg/vegan/R/postMDS.R
   pkg/vegan/inst/ChangeLog
Log:
change attributes(x)$which --> attr(x, "which")

Modified: pkg/vegan/R/anosim.R
===================================================================
--- pkg/vegan/R/anosim.R	2011-09-04 20:02:19 UTC (rev 1791)
+++ pkg/vegan/R/anosim.R	2011-09-05 19:19:50 UTC (rev 1792)
@@ -18,7 +18,7 @@
         grouping[irow] == grouping[icol]
     }
     x.rank <- rank(x)
-    N <- attributes(x)$Size
+    N <- attr(x, "Size")
     div <- length(x)/2
     irow <- as.vector(as.dist(row(matrix(nrow = N, ncol = N))))
     icol <- as.vector(as.dist(col(matrix(nrow = N, ncol = N))))

Modified: pkg/vegan/R/initMDS.R
===================================================================
--- pkg/vegan/R/initMDS.R	2011-09-04 20:02:19 UTC (rev 1791)
+++ pkg/vegan/R/initMDS.R	2011-09-05 19:19:50 UTC (rev 1792)
@@ -1,7 +1,7 @@
 "initMDS" <-
   function(x, k=2)
 {
-  nr <- attributes(x)$Size
+  nr <- attr(x, "Size")
   res <- runif(nr*k)
   dim(res) <- c(nr,k)
   res

Modified: pkg/vegan/R/mantel.R
===================================================================
--- pkg/vegan/R/mantel.R	2011-09-04 20:02:19 UTC (rev 1791)
+++ pkg/vegan/R/mantel.R	2011-09-05 19:19:50 UTC (rev 1792)
@@ -8,7 +8,7 @@
     statistic <- as.numeric(tmp$estimate)
     variant <- tmp$method
     if (permutations) {
-        N <- attributes(xdis)$Size
+        N <- attr(xdis, "Size")
         perm <- rep(0, permutations)
         ## asdist asn an index selects lower diagonal like as.dist,
         ## but is faster since it does not seet 'dist' attributes

Modified: pkg/vegan/R/mantel.partial.R
===================================================================
--- pkg/vegan/R/mantel.partial.R	2011-09-04 20:02:19 UTC (rev 1791)
+++ pkg/vegan/R/mantel.partial.R	2011-09-05 19:19:50 UTC (rev 1792)
@@ -15,7 +15,7 @@
     rxy <- rxy$estimate
     statistic <- part.cor(rxy, rxz, ryz)
     if (permutations) {
-        N <- attributes(xdis)$Size
+        N <- attr(xdis, "Size")
         perm <- rep(0, permutations)
         xmat <- as.matrix(xdis)
         asdist <- row(xmat) > col(xmat)

Modified: pkg/vegan/R/mso.R
===================================================================
--- pkg/vegan/R/mso.R	2011-09-04 20:02:19 UTC (rev 1791)
+++ pkg/vegan/R/mso.R	2011-09-05 19:19:50 UTC (rev 1792)
@@ -65,7 +65,7 @@
             object$H.test[, i] <- as.numeric(object$H == object$vario$H[i])
         }
         xdis <- dist(object$CA$Xbar)^2
-        N <- attributes(xdis)$Size
+        N <- attr(xdis, "Size")
         statistic <- abs(cor(as.vector(xdis), object$H.test))
         perm <- matrix(0, length(statistic), permutations)
         for (i in 1:permutations) {

Modified: pkg/vegan/R/postMDS.R
===================================================================
--- pkg/vegan/R/postMDS.R	2011-09-04 20:02:19 UTC (rev 1791)
+++ pkg/vegan/R/postMDS.R	2011-09-05 19:19:50 UTC (rev 1792)
@@ -2,8 +2,8 @@
     function (X, dist, pc = TRUE, center = TRUE, halfchange, 
               threshold = 0.8, nthreshold = 10, plot = FALSE, ...) 
 {
-    Size <- attributes(dist)$Size
-    if (any(attributes(X)$names == "points")) 
+    Size <- attr(dist, "Size")
+    if (any(names(X) == "points")) 
         x <- X$points
     else x <- as.matrix(X)
     if (center) 
@@ -71,7 +71,7 @@
     attr(x, "centre") <- center
     attr(x, "pc") <- pc
     attr(x, "halfchange") <- halfchange
-    if (any(attributes(X)$names == "points")) 
+    if (any(names(X) == "points")) 
         X$points <- x
     else X <- x
     X

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2011-09-04 20:02:19 UTC (rev 1791)
+++ pkg/vegan/inst/ChangeLog	2011-09-05 19:19:50 UTC (rev 1792)
@@ -6,6 +6,15 @@
 
 	* opened the release candidate ov vegan_2.0-0.
 
+	* some old functions used attributes(x)$which instead of more
+	correct attr(x, "which"), and in addition postMDS() used
+	attributes(x)$names instead of names(). Concerns anosim(),
+	initMDS(), postMDS(), mantel(), mantel.partial() and
+	mso(). initMDS() was one of the two functions that was unchanged
+	since the first vegan release on 6/9/01, and it was changed day
+	before it turned ten-years-old. After this, wisconsin() is the
+	only unchanged function from the first release.
+
 Version 1.92-2 (closed September 3, 2011)
 
 	* monoMDS: saves and displays info on the dissimilarities used,



More information about the Vegan-commits mailing list