[Vegan-commits] r1531 - in pkg/vegan: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 10 11:51:09 CET 2011


Author: jarioksa
Date: 2011-03-10 11:51:08 +0100 (Thu, 10 Mar 2011)
New Revision: 1531

Modified:
   pkg/vegan/DESCRIPTION
   pkg/vegan/R/ordisurf.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/ordisurf.Rd
Log:
ordisurf got a formula interface

Modified: pkg/vegan/DESCRIPTION
===================================================================
--- pkg/vegan/DESCRIPTION	2011-03-09 14:28:01 UTC (rev 1530)
+++ pkg/vegan/DESCRIPTION	2011-03-10 10:51:08 UTC (rev 1531)
@@ -1,7 +1,7 @@
 Package: vegan
 Title: Community Ecology Package
-Version: 1.18-24
-Date: February 28, 2011
+Version: 1.18-25
+Date: March 10, 2011
 Author: Jari Oksanen, F. Guillaume Blanchet, Roeland Kindt, Pierre Legendre, 
    R. B. O'Hara, Gavin L. Simpson, Peter Solymos, M. Henry H. Stevens, 
    Helene Wagner  

Modified: pkg/vegan/R/ordisurf.R
===================================================================
--- pkg/vegan/R/ordisurf.R	2011-03-09 14:28:01 UTC (rev 1530)
+++ pkg/vegan/R/ordisurf.R	2011-03-10 10:51:08 UTC (rev 1531)
@@ -1,4 +1,21 @@
 `ordisurf` <-
+    function(...) UseMethod("ordisurf")
+
+`ordisurf.formula` <-
+    function(formula, data, ...)
+{
+    if (missing(data))
+        data <- parent.frame()
+    x <- formula[[2]]
+    x <- eval.parent(x)
+    formula[[2]] <- NULL
+    y <- drop(as.matrix(model.frame(formula, data, na.action = na.pass)))
+    if (NCOL(y) > 1)
+        stop(gettextf("only one fitted variable allowed in the formula"))
+    ordisurf(x, y, ...)
+}
+
+`ordisurf.default` <-
     function (x, y, choices = c(1, 2), knots = 10, family = "gaussian", 
               col = "red", thinplate = TRUE, add = FALSE, display = "sites", 
               w = weights(x), main, nlevels = 10, levels, labcex = 0.6,

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2011-03-09 14:28:01 UTC (rev 1530)
+++ pkg/vegan/inst/ChangeLog	2011-03-10 10:51:08 UTC (rev 1531)
@@ -2,8 +2,12 @@
 
 VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
 
+Version 1.18-25 (opened March 10, 2011)
 
-Version 1.18-24 (opened February 28, 2011)
+	* ordisurf: got a formula interface as an alternative to define
+	the model.
+	
+Version 1.18-24 (closed March 10, 2011)
 
 	* cca: will return NULL item for CCA only if constraints were not
 	given. If the CCA component has zero rank (= constraints were
@@ -32,7 +36,6 @@
 	functions documented in ?diversity now accept vector input.
 	Function fisher.alpha and drararefy already accepted vectors.
 
-
 Version 1.18-23 (closed February 28, 2011)
 
 	* opened with the release of 1.17-7 based on version 1.18-22 on

Modified: pkg/vegan/man/ordisurf.Rd
===================================================================
--- pkg/vegan/man/ordisurf.Rd	2011-03-09 14:28:01 UTC (rev 1530)
+++ pkg/vegan/man/ordisurf.Rd	2011-03-10 10:51:08 UTC (rev 1531)
@@ -8,10 +8,11 @@
   plots the result on ordination diagram.
 }
 \usage{
-ordisurf(x, y, choices=c(1, 2), knots=10, family="gaussian", col="red",
+\method{ordisurf}{default}(x, y, choices=c(1, 2), knots=10, family="gaussian", col="red",
      thinplate = TRUE, add = FALSE, display = "sites",
      w = weights(x), main, nlevels = 10, levels, labcex = 0.6,
      bubble = FALSE, cex = 1, ...)
+\method{ordisurf}{formula}(formula, data, ...)
 \method{calibrate}{ordisurf}(object, newdata, ...)
 }
 
@@ -47,10 +48,18 @@
     the maximum. The minimum size will always be \code{cex = 0.4}.  The
     option only has an effect if \code{add = FALSE}.}
   \item{cex}{Character expansion of plotting symbols.}
+  \item{formula, data}{Alternative definition of the fitted model as
+    \code{x ~ y}, or left-hand side is the ordination \code{x} and
+    right-hand side the single fitted continuous variable
+    \code{y}. The variable \code{y} must be in the working environment
+    or in the data frame or environment given by \code{data}. All
+    other arguments of are passed to the default method.}
   \item{object}{An \code{ordisurf} result object.}
   \item{newdata}{Coordinates in two-dimensional ordination for new points.}
-  \item{\dots}{ Other graphical parameters. }
+  \item{\dots}{Other parameters passed to \code{\link[mgcv]{gam}}, or
+    to the graphical functions.}
 }
+
 \details{
   Function \code{ordisurf} fits a smooth surface using thinplate splines
   in \code{\link[mgcv]{gam}}, and uses \code{\link[mgcv]{predict.gam}}



More information about the Vegan-commits mailing list