[Vegan-commits] r1554 - in branches/1.17: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Mar 26 16:52:37 CET 2011


Author: jarioksa
Date: 2011-03-26 16:52:36 +0100 (Sat, 26 Mar 2011)
New Revision: 1554

Modified:
   branches/1.17/R/anova.ccabyaxis.R
   branches/1.17/R/ordilabel.R
   branches/1.17/inst/ChangeLog
   branches/1.17/inst/NEWS
   branches/1.17/man/ordilabel.Rd
Log:
merge r 1550:1552: ordilabel gained 'xpd' and anova.cca(..., by = 'axis') fix

Modified: branches/1.17/R/anova.ccabyaxis.R
===================================================================
--- branches/1.17/R/anova.ccabyaxis.R	2011-03-23 17:51:28 UTC (rev 1553)
+++ branches/1.17/R/anova.ccabyaxis.R	2011-03-26 15:52:36 UTC (rev 1554)
@@ -14,11 +14,26 @@
     } else {
         u <- object$CCA$u
     }
+    ## Get conditions
+    if (!is.null(object$pCCA)) {
+        CondMat <- qr.X(object$pCCA$QR)
+        ## deweight if CCA
+        if (!inherits(object, "rda"))
+            CondMat <- sweep(CondMat, 1, sqrt(object$rowsum), "/")
+    }
+    else
+        CondMat <- NULL
     ## pad with NA rows if there is a subset
     if (!is.null(object$subset)) {
         lc <- matrix(NA, nrow=length(object$subset),
-                     ncol = ncol(u))
+                     ncol = NCOL(u))
         lc[object$subset,]  <- u
+        if (!is.null(CondMat)) {
+            tmp <- matrix(NA, nrow=length(object$subset),
+                          ncol = NCOL(CondMat))
+            tmp[object$subset,] <- CondMat
+            CondMat <- tmp
+        }
         object$call$subset <- object$subset
     } else {
         lc <- u
@@ -34,6 +49,8 @@
     environment(object$terms) <- environment()
     fla <- paste(". ~ ", axnam[1], "+ Condition(",
                  paste(axnam[-1], collapse="+"),")")
+    if (!is.null(CondMat))
+        fla <- paste(fla, " + Condition(CondMat)")
     fla <- update(formula(object), fla)
     sol <- anova(update(object, fla, data=lc),  ...)
     out[c(1, rnk + 1), ] <- sol
@@ -48,11 +65,12 @@
         for (.ITRM in 2:rnk) {
             fla <- paste(".~", axnam[.ITRM], "+Condition(",
                          paste(axnam[-(.ITRM)], collapse="+"),")")
+            if (!is.null(CondMat))
+                fla <- paste(fla, "+ Condition(CondMat)")
             fla <- update(formula(object),  fla) 
             sol <- update(object, fla, data = lc)
             assign(".Random.seed", seed, envir = .GlobalEnv)
-            out[.ITRM, ] <- as.matrix(anova(sol, ...))[1, 
-                ]
+            out[.ITRM, ] <- as.matrix(anova(sol, ...))[1,]
             if (out[.ITRM, "N.Perm"] > bigperm) {
                 bigperm <- out[.ITRM, "N.Perm"]
                 bigseed <- get(".Random.seed", envir = .GlobalEnv, 

Modified: branches/1.17/R/ordilabel.R
===================================================================
--- branches/1.17/R/ordilabel.R	2011-03-23 17:51:28 UTC (rev 1553)
+++ branches/1.17/R/ordilabel.R	2011-03-26 15:52:36 UTC (rev 1554)
@@ -1,7 +1,7 @@
 `ordilabel` <-
     function(x, display, labels, choices = c(1,2), priority,
              cex = 0.8, fill = "white", border = NULL, col = NULL,
-             ...)
+             xpd = TRUE, ...)
 {
     if (missing(display))
         display <- "sites"
@@ -24,8 +24,9 @@
             col <- par("fg")
     for (i in 1:nrow(x)) {
         polygon(x[i,1] + c(-1,1,1,-1)*w[i], x[i,2] + c(-1,-1,1,1)*h[i],
-                col = fill, border = border)
-        text(x[i,1], x[i,2], labels = labels[i], cex = cex, col = col, ...)
+                col = fill, border = border, xpd = xpd)
+        text(x[i,1], x[i,2], labels = labels[i], cex = cex, col = col,
+             xpd = xpd, ...)
     }
     invisible(x)
 }

Modified: branches/1.17/inst/ChangeLog
===================================================================
--- branches/1.17/inst/ChangeLog	2011-03-23 17:51:28 UTC (rev 1553)
+++ branches/1.17/inst/ChangeLog	2011-03-26 15:52:36 UTC (rev 1554)
@@ -4,13 +4,18 @@
 
 Version 1.17-9 (opened March 9, 2011)
 
-	* merged 1534: typo in vegdist.Rd.
-
+	* merged 1551,2: anova.cca(..., by = "axis") failed in partial
+	models. 
+	
+	* merged 1550: ordilabel gained arg 'xpd'.
+	
 	* merged 1541,8: metaMDSiter got more flexible 'previous.tries. 
 
 	* merged 1538,9, 1542,5: ordisurf gaine new arguments and got a
 	new plot method.
 
+	* merged 1534: typo in vegdist.Rd.
+
 	* merged r1533,7, 1544,7: metaMDSrotate works with > 2 dim.
 
 	* merged r1532: fix gettextf in d/r/rarefy.

Modified: branches/1.17/inst/NEWS
===================================================================
--- branches/1.17/inst/NEWS	2011-03-23 17:51:28 UTC (rev 1553)
+++ branches/1.17/inst/NEWS	2011-03-26 15:52:36 UTC (rev 1554)
@@ -5,8 +5,11 @@
 
                        CHANGES IN VEGAN 1.17-9
 
+    - anova of cca/rda/capscale results gave wrong results in partial
+      models. The bug was introduced in vegan 1.17-7. 
+
     - diversity and related functions rarefy, rrarefy and specnumber
-      accept now a vector input. Earlier a single site had to be
+      accept now vector input. Earlier a single site had to be
       analysed either as a one-row matrix or using non-default setting
       MARGIN = 2.
 
@@ -26,6 +29,9 @@
       of dimensions so that the first axis is parallel to a fitted
       environmental vector. Earlier only two dimensions worked.
 
+    - ordilabel: gained argument 'xpd' that allows labels outside the
+      plot area. This allows labels above axes, for instance.
+
     - ordisurf: gained several new arguments to control the gam
       fitting. Also gained an argument to suppress plotting, and a new
       plot method. The fitted model can be specified with a formula. 

Modified: branches/1.17/man/ordilabel.Rd
===================================================================
--- branches/1.17/man/ordilabel.Rd	2011-03-23 17:51:28 UTC (rev 1553)
+++ branches/1.17/man/ordilabel.Rd	2011-03-26 15:52:36 UTC (rev 1554)
@@ -11,7 +11,7 @@
 
 \usage{
 ordilabel(x, display, labels, choices = c(1, 2), priority, cex = 0.8,
-    fill = "white", border = NULL, col = NULL, ...)
+    fill = "white", border = NULL, col = NULL, xpd = TRUE, ...)
 }
 
 \arguments{
@@ -31,7 +31,9 @@
   \item{border}{The colour and visibility of the border of the label as
     defined in \code{\link{polygon}}).}
   \item{col}{Text colour. Default \code{NULL} will give the value of
-    \code{border} or \code{par("fg")} if \code{border} is \code{NULL}.} 
+    \code{border} or \code{par("fg")} if \code{border} is \code{NULL}.}
+  \item{xpd}{Draw labels also outside the plot region (see 
+    \code{\link{par}}).} 
   \item{\dots}{Other arguments (passed to \code{\link{text}}). }
 }
 



More information about the Vegan-commits mailing list