[Vegan-commits] r844 - in pkg/vegan: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun May 31 17:12:12 CEST 2009


Author: jarioksa
Date: 2009-05-31 17:12:12 +0200 (Sun, 31 May 2009)
New Revision: 844

Modified:
   pkg/vegan/R/eigenvals.R
   pkg/vegan/man/eigenvals.Rd
Log:
eigenvals.cca optionally returns only constrained eigenvalues

Modified: pkg/vegan/R/eigenvals.R
===================================================================
--- pkg/vegan/R/eigenvals.R	2009-05-31 14:44:50 UTC (rev 843)
+++ pkg/vegan/R/eigenvals.R	2009-05-31 15:12:12 UTC (rev 844)
@@ -1,13 +1,13 @@
 # Extract eigenvalues from an object that has them
 
 `eigenvals` <-
-    function(x)
+    function(x, ...)
 {
     UseMethod("eigenvals")
 }
 
 `eigenvals.default`<-
-    function(x)
+    function(x, ...)
 {
     ## svd and eigen return unspecified 'list', see if this could be
     ## either of them
@@ -26,7 +26,7 @@
 
 ## squares of sdev 
 `eigenvals.prcomp` <-
-    function(x)
+    function(x, ...)
 {
     out <- x$sdev^2
     names(out) <- colnames(x$rotation)
@@ -36,7 +36,7 @@
 
 ## squares of sdev
 `eigenvals.princomp` <-
-    function(x)
+    function(x, ...)
 {
     out <- x$sdev^2
     class(out) <- "eigenvals"
@@ -45,16 +45,19 @@
 
 ## concatenate constrained and unconstrained eigenvalues in cca, rda
 ## and capscale (vegan) -- ignore pCCA component
-`eigenvals.cca` <- function(x)
+`eigenvals.cca` <- function(x, constrained = FALSE, ...)
 {
-   out <- c(x$CCA$eig, x$CA$eig)
+   if (constrained)
+       out <- x$CCA$eig
+   else
+       out <- c(x$CCA$eig, x$CA$eig)
    class(out) <- c("eigenvals")
    out
 }
 
 ## wcmdscale (in vegan)
 `eigenvals.wcmdscale` <-
-    function(x)
+    function(x, ...)
 {
     out <- x$eig
     class(out) <-"eigenvals"

Modified: pkg/vegan/man/eigenvals.Rd
===================================================================
--- pkg/vegan/man/eigenvals.Rd	2009-05-31 14:44:50 UTC (rev 843)
+++ pkg/vegan/man/eigenvals.Rd	2009-05-31 15:12:12 UTC (rev 844)
@@ -17,7 +17,8 @@
   multivariate methods return such objects. 
 }
 \usage{
-eigenvals(x)
+eigenvals(x, ...)
+\method{eigenvals}{cca}(x, constrained = FALSE, ...)
 \method{summary}{eigenvals}(object, ...)
 }
 
@@ -27,8 +28,14 @@
 }
   \item{object}{
     An \code{eigenvals} result object.
-}	
 }
+   \item{constrained}{
+    Return only constrained eigenvalues.
+}
+   \item{\dots}{
+    Other arguments to the functions (usually ignored)
+}
+}
 
 \details{
   This is a generic function that has methods for \code{\link{cca}},
@@ -44,7 +51,8 @@
   methods \code{\link{cca}}, \code{\link{rda}} and
   \code{\link{capscale}} the function returns the both constrained and
   unconstrained eigenvalues concatenated in one vector, but the partial
-  component will be ignored.
+  component will be ignored. However, with argument 
+  \code{constrained = TRUE} only constrained eigenvalues are returned. 
 
   The \code{summary} of \code{eigenvals} result returns eigenvalues,
   proportion explained and cumulative proportion explained.



More information about the Vegan-commits mailing list