[Vegan-commits] r1483 - in pkg/vegan: R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Feb 10 21:38:32 CET 2011
Author: jarioksa
Date: 2011-02-10 21:38:32 +0100 (Thu, 10 Feb 2011)
New Revision: 1483
Modified:
pkg/vegan/R/eigenvals.R
pkg/vegan/inst/ChangeLog
pkg/vegan/man/eigenvals.Rd
Log:
eigenvals learnt labdsv pco & pca objects
Modified: pkg/vegan/R/eigenvals.R
===================================================================
--- pkg/vegan/R/eigenvals.R 2011-02-10 11:21:42 UTC (rev 1482)
+++ pkg/vegan/R/eigenvals.R 2011-02-10 20:38:32 UTC (rev 1483)
@@ -88,6 +88,32 @@
out
}
+## labdsv::pco
+
+`eigenvals.pco` <-
+ function(x)
+{
+ out <- x$eig
+ class(out) <- "eigenvals"
+ out
+}
+
+## labdsv::pca
+
+`eigenvals.pca` <-
+ function(x)
+{
+ out <- x$sdev^2
+ ## pca() may return only some first eigenvalues
+ if ((seig <- sum(out)) < x$totdev) {
+ names(out) <- paste("PC", seq_along(out), sep="")
+ out <- c(out, "Rest" = x$totdev - seig)
+ }
+ class(out) <- "eigenvals"
+ out
+}
+
+
`print.eigenvals` <-
function(x, ...)
{
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2011-02-10 11:21:42 UTC (rev 1482)
+++ pkg/vegan/inst/ChangeLog 2011-02-10 20:38:32 UTC (rev 1483)
@@ -4,7 +4,8 @@
Version 1.18-22 (opened January 19, 2011)
- * eigenvals: learnt to know 'dudi' objects of ade4 package.
+ * eigenvals: learnt to know 'dudi' objects of the ade4 package,
+ and 'pco' an 'pca' obejct of the labdsv package.
* betadisper: streamlined code somewhat.
Modified: pkg/vegan/man/eigenvals.Rd
===================================================================
--- pkg/vegan/man/eigenvals.Rd 2011-02-10 11:21:42 UTC (rev 1482)
+++ pkg/vegan/man/eigenvals.Rd 2011-02-10 20:38:32 UTC (rev 1483)
@@ -41,8 +41,9 @@
\details{
This is a generic function that has methods for \code{\link{cca}},
\code{\link{wcmdscale}}, \code{\link{pcnm}}, \code{\link{prcomp}},
- \code{\link{princomp}}, and\code{\link[ade4]{dudi}} (of \pkg{ade4})
- result objects. The default method also
+ \code{\link{princomp}}, \code{\link[ade4]{dudi}} (of \pkg{ade4}), and
+ \code{\link[labdsv]{pca}} and \code{\link[labdsv]{pco}} (of
+ \pkg{labdsv}) result objects. The default method also
extracts eigenvalues if the result looks like being from
\code{\link{eigen}} or \code{\link{svd}}. Functions
\code{\link{prcomp}} and \code{\link{princomp}} contain square roots
More information about the Vegan-commits
mailing list