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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Nov 12 11:43:27 CET 2010


Author: jarioksa
Date: 2010-11-12 11:43:27 +0100 (Fri, 12 Nov 2010)
New Revision: 1367

Modified:
   pkg/vegan/R/pcnm.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/pcnm.Rd
Log:
pcnm can return the distances it uses

Modified: pkg/vegan/R/pcnm.R
===================================================================
--- pkg/vegan/R/pcnm.R	2010-11-12 10:26:27 UTC (rev 1366)
+++ pkg/vegan/R/pcnm.R	2010-11-12 10:43:27 UTC (rev 1367)
@@ -1,5 +1,5 @@
-"pcnm" <-
-    function(dis, threshold, w)
+`pcnm` <-
+    function(dis, threshold, w, dist.ret = FALSE)
 {
     EPS <- sqrt(.Machine$double.eps)
     wa.old <- options(warn = -1)
@@ -19,6 +19,11 @@
     res$vectors <- sweep(res$vectors, 2, sqrt(res$values[1:k]), "/")
     colnames(res$vectors) <- paste("PCNM", 1:k, sep="")
     res$threshold <- threshold
+    if (dist.ret) {
+        attr(dis, "method") <- paste(attr(dis, "method"), "pcnm")
+        attr(dis, "threshold") <- threshold
+        res$dist <- dis
+    }
     class(res) <- "pcnm"
     res
 }

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-11-12 10:26:27 UTC (rev 1366)
+++ pkg/vegan/inst/ChangeLog	2010-11-12 10:43:27 UTC (rev 1367)
@@ -4,6 +4,9 @@
 
 Version 1.18-16 (opened November 9, 2010)
 
+	* pcnm: gained argument 'dist.ret' to return the distance matrix
+	on which PCNMs were based.
+
 	* cca/rda/capscale: JO yielded to the pressure, and added
 	proportions of inertia components in the printed output.
 

Modified: pkg/vegan/man/pcnm.Rd
===================================================================
--- pkg/vegan/man/pcnm.Rd	2010-11-12 10:26:27 UTC (rev 1366)
+++ pkg/vegan/man/pcnm.Rd	2010-11-12 10:43:27 UTC (rev 1367)
@@ -9,7 +9,7 @@
   constrained ordination or regression. 
 }
 \usage{
-pcnm(dis, threshold, w)
+pcnm(dis, threshold, w, dist.ret = FALSE)
 }
 
 \arguments{
@@ -19,6 +19,7 @@
     used. This is found as the longest distance in the minimum spanning
     tree of \code{dis}. }
   \item{w}{Prior weights for rows.}
+  \item{dist.ret}{Return the distances used to calculate the PCNMs.}
 }
 
 \details{
@@ -58,15 +59,21 @@
   }
 
 \value{
-  A list of three elements:
+  A list of the following elements:
   \item{values }{Eigenvalues obtained by the principal coordinates
     analysis.} 
   \item{vectors }{Eigenvectors obtained by the principal coordinates
     analysis. They are scaled to unit norm. The vectors can be extracted 
     with \code{scores} function. The default is to return all PCNM vectors,
     but argument \code{choices} selects the given vectors.} 
- \item{threshold}{Truncation distance.} 
+ \item{threshold}{Truncation distance.}
+ \item{dist}{The distance matrix where values above \code{threshold}
+    are replaced with arbitrary value of four times the
+    threshold. String \code{"pcnm"} is added to the \code{method}
+    attribute, and new attribute \code{threshold} is added to the
+    distances. This is returned only when \code{dist.ret = TRUE}.  }
 }
+
 \references{
   Borcard D. and Legendre P. (2002) All-scale spatial analysis of
   ecological data by means of principal coordinates of neighbour



More information about the Vegan-commits mailing list