[Vegan-commits] r365 - in pkg: . R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 22 10:21:30 CEST 2008


Author: jarioksa
Date: 2008-05-22 10:21:30 +0200 (Thu, 22 May 2008)
New Revision: 365

Modified:
   pkg/DESCRIPTION
   pkg/R/factorfit.R
   pkg/R/inertcomp.R
   pkg/R/intersetcor.R
   pkg/R/ordicluster.R
   pkg/R/ordiellipse.R
   pkg/R/ordispider.R
   pkg/R/ordisurf.R
   pkg/R/orglspider.R
   pkg/R/vectorfit.R
   pkg/inst/ChangeLog
Log:
workaround to R 2.7.0 where weights() give an error if object has no weights: weights.default defined internally. Some functions worked only with 'cca' objects, but did not check their input

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2008-05-21 08:53:29 UTC (rev 364)
+++ pkg/DESCRIPTION	2008-05-22 08:21:30 UTC (rev 365)
@@ -1,7 +1,7 @@
 Package: vegan
 Title: Community Ecology Package
-Version: 1.14-0
-Date: May 15, 2008
+Version: 1.14-1
+Date: May 22, 2008
 Author: Jari Oksanen, Roeland Kindt, Pierre Legendre, Bob O'Hara, Gavin L. Simpson, 
   M. Henry H. Stevens  
 Maintainer: Jari Oksanen <jari.oksanen at oulu.fi>

Modified: pkg/R/factorfit.R
===================================================================
--- pkg/R/factorfit.R	2008-05-21 08:53:29 UTC (rev 364)
+++ pkg/R/factorfit.R	2008-05-22 08:21:30 UTC (rev 365)
@@ -2,6 +2,7 @@
     function (X, P, permutations = 0, strata, choices = c(1, 2),
               display = c("sites","lc"), w = weights(X),  ...) 
 {
+    weights.default <- function(object, ...) NULL
     display <- match.arg(display)
     w <- eval(w)
     P <- as.data.frame(P)

Modified: pkg/R/inertcomp.R
===================================================================
--- pkg/R/inertcomp.R	2008-05-21 08:53:29 UTC (rev 364)
+++ pkg/R/inertcomp.R	2008-05-22 08:21:30 UTC (rev 365)
@@ -4,6 +4,8 @@
 {
     display <- match.arg(display)
     statistic <- match.arg(statistic)
+    if (!inherits(object, "cca"))
+        stop("can be used only with objects inheriting from 'cca'")
     if (inherits(object, "capscale") && display == "species")
         stop("cannot analyse species with 'capscale'")
     pCCA <- object$pCCA$Fit

Modified: pkg/R/intersetcor.R
===================================================================
--- pkg/R/intersetcor.R	2008-05-21 08:53:29 UTC (rev 364)
+++ pkg/R/intersetcor.R	2008-05-22 08:21:30 UTC (rev 365)
@@ -1,5 +1,7 @@
 intersetcor <- function(object) 
 {
+    if (!inherits(object, "cca"))
+        stop("can be used only with objects inheriting from 'cca'")
     w <- weights(object)
     wa <- sweep(object$CCA$wa, 1, sqrt(w), "*")
     cor(qr.X(object$CCA$QR), wa)

Modified: pkg/R/ordicluster.R
===================================================================
--- pkg/R/ordicluster.R	2008-05-21 08:53:29 UTC (rev 364)
+++ pkg/R/ordicluster.R	2008-05-22 08:21:30 UTC (rev 365)
@@ -2,6 +2,7 @@
     function (ord, cluster, prune=0, display="sites", w = weights(ord, display),
               ...)
 {
+    weights.default <- function(object, ...) NULL
     w <- eval(w)
     mrg <- cluster$merge
     ord <- scores(ord, display = display, ...)

Modified: pkg/R/ordiellipse.R
===================================================================
--- pkg/R/ordiellipse.R	2008-05-21 08:53:29 UTC (rev 364)
+++ pkg/R/ordiellipse.R	2008-05-22 08:21:30 UTC (rev 365)
@@ -5,6 +5,7 @@
 {
     if (!require(ellipse))
         stop("Requires package `ellipse' (from CRAN)")
+    weights.default <- function(object, ...) NULL
     kind <- match.arg(kind)
     draw <- match.arg(draw)
     pts <- scores(ord, display = display, ...)

Modified: pkg/R/ordispider.R
===================================================================
--- pkg/R/ordispider.R	2008-05-21 08:53:29 UTC (rev 364)
+++ pkg/R/ordispider.R	2008-05-22 08:21:30 UTC (rev 365)
@@ -2,6 +2,7 @@
     function (ord, groups, display = "sites", w = weights(ord, display),
               show.groups, ...)
 {
+    weights.default <- function(object, ...) NULL
     if (inherits(ord, "cca") && missing(groups)) {
         lc <- scores(ord, display = "lc", ...)
         wa <- scores(ord, display = "wa", ...)

Modified: pkg/R/ordisurf.R
===================================================================
--- pkg/R/ordisurf.R	2008-05-21 08:53:29 UTC (rev 364)
+++ pkg/R/ordisurf.R	2008-05-22 08:21:30 UTC (rev 365)
@@ -3,6 +3,7 @@
               col = "red", thinplate = TRUE, add = FALSE, display = "sites", 
               w = weights(x), main, nlevels = 10, levels, labcex = 0.6,  ...) 
 {
+    weights.default <- function(object, ...) NULL
     GRID = 25
     w <- eval(w)
     if (!is.null(w) && length(w) == 1) 

Modified: pkg/R/orglspider.R
===================================================================
--- pkg/R/orglspider.R	2008-05-21 08:53:29 UTC (rev 364)
+++ pkg/R/orglspider.R	2008-05-22 08:21:30 UTC (rev 365)
@@ -2,6 +2,7 @@
     function (object, groups, display = "sites",
               w = weights(object, display), choices = 1:3, ...) 
 {
+    weights.default <- function(object, ...) NULL
     if (inherits(object, "cca") && missing(groups)) {
         lc <- scores(object, display = "lc", choices = choices, ...)
         wa <- scores(object, display = "wa", choices = choices, ...)

Modified: pkg/R/vectorfit.R
===================================================================
--- pkg/R/vectorfit.R	2008-05-21 08:53:29 UTC (rev 364)
+++ pkg/R/vectorfit.R	2008-05-22 08:21:30 UTC (rev 365)
@@ -2,6 +2,7 @@
     function (X, P, permutations = 0, strata, choices = c(1, 2), 
               display = c("sites", "lc"), w = weights(X), ...) 
 {
+    weights.default <- function(object, ...) NULL
     display <- match.arg(display)
     w <- eval(w)
     X <- scores(X, display = display, choices, ...)

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2008-05-21 08:53:29 UTC (rev 364)
+++ pkg/inst/ChangeLog	2008-05-22 08:21:30 UTC (rev 365)
@@ -2,8 +2,26 @@
 
 VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
 
-Version 1.14-0 (opened May 14, 2008)
+Version 1.14-1 (opened May 22, 2008)
 
+	* weights failed in several ordination utilities, because
+	weights.default in R 2.7.0 (stats) could not cope with objects
+	that do not have weights. R 2.6.2 still returned NULL for those
+	objects, but now weights.default gives an error. As a workaround
+	several vegan functions define internally 
+	       weights.default <- function(object, ...) NULL 
+	to get back the old behaviour. Concerns orglspider, ordicluster,
+	ordispider, ordiellipse, ordisurf, factorfit, vectorfit.
+
+	* inertcomp and intersetcor only work with objects inheriting from
+	"cca", but they did not check that the object was of the correct
+	type and so could end up with calling weights.default or give
+	obscure error messages. 
+	
+Version 1.14-0 (closed May 21, 2008)
+
+	* The base of the release version 1.13-0.
+
 Version 1.12-15 (closed May 14, 2008)
 
 	* closed the revision and made it as the base of release branch



More information about the Vegan-commits mailing list