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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Oct 29 08:00:01 CET 2009


Author: jarioksa
Date: 2009-10-29 08:00:00 +0100 (Thu, 29 Oct 2009)
New Revision: 1063

Added:
   pkg/vegan/R/scores.pcnm.R
Modified:
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/pcnm.Rd
Log:
added scores.pncm

Added: pkg/vegan/R/scores.pcnm.R
===================================================================
--- pkg/vegan/R/scores.pcnm.R	                        (rev 0)
+++ pkg/vegan/R/scores.pcnm.R	2009-10-29 07:00:00 UTC (rev 1063)
@@ -0,0 +1,8 @@
+`scores.pcnm` <-
+    function(x, choices, ...)
+{
+    if (missing(choices))
+        x$vectors
+    else
+        x$vectors[, choices]
+}

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2009-10-28 17:47:38 UTC (rev 1062)
+++ pkg/vegan/inst/ChangeLog	2009-10-29 07:00:00 UTC (rev 1063)
@@ -15,7 +15,8 @@
 	Neighbourhood Matrix) with option for row weighs allowing PCNM for
 	cca. Based on Stéphane Dray's PCNM function in his (unreleased)
 	SpacemakeR package. Imported with history from sedarVegan in
-	http://sedar.r-forge.r-project.org/. 
+	http://sedar.r-forge.r-project.org/. Has scores.pcnm to select all
+	(default) or some vectors of 'choice'.
 
 	* decostand: implemented Marti Anderson's log scaling of type
 	log(x, base = logbase) + 1 as a part of Feature Request #473. The

Modified: pkg/vegan/man/pcnm.Rd
===================================================================
--- pkg/vegan/man/pcnm.Rd	2009-10-28 17:47:38 UTC (rev 1062)
+++ pkg/vegan/man/pcnm.Rd	2009-10-29 07:00:00 UTC (rev 1063)
@@ -1,5 +1,6 @@
 \name{pcnm}
 \alias{pcnm}
+\alias{scores.pcnm}
 \title{ Principal Coordinates of Neighbourhood Matrix }
 \description{
   This function computed classical PCNM by the principal coordinate
@@ -61,7 +62,9 @@
   \item{values }{Eigenvalues obtained by the principal coordinates
     analysis.} 
   \item{vectors }{Eigenvectors obtained by the principal coordinates
-    analysis. They are normalized to unit norm.}
+    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.} 
 }
 \references{
@@ -84,15 +87,18 @@
 data(mite.xy)
 pcnm1 <- pcnm(dist(mite.xy))
 op <- par(mfrow=c(1,3))
-ordisurf(mite.xy, pcnm1$vectors[,1], bubble = 4, main = "PCNM 1")
-ordisurf(mite.xy, pcnm1$vectors[,2], bubble = 4, main = "PCNM 2")
-ordisurf(mite.xy, pcnm1$vectors[,3], bubble = 4, main = "PCNM 3")
+## Map of PCNMs in the sample plot
+ordisurf(mite.xy, scores(pcnm1, choi=1), bubble = 4, main = "PCNM 1")
+ordisurf(mite.xy, scores(pcnm1, choi=2), bubble = 4, main = "PCNM 2")
+ordisurf(mite.xy, scores(pcnm1, choi=3), bubble = 4, main = "PCNM 3")
 par(op)
+## Plot first PCNMs against each other
+ordisplom(pcnm1, choices=1:4)
 ## Weighted PCNM for CCA
 data(mite)
 rs <- rowSums(mite)/sum(mite)
 pcnmw <- pcnm(dist(mite.xy), w = rs)
-ord <- cca(mite ~ pcnmw$vectors)
+ord <- cca(mite ~ scores(pcnmw))
 ## Multiscale ordination: residual variance should have no distance
 ## trend
 msoplot(mso(ord, mite.xy))



More information about the Vegan-commits mailing list