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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Apr 4 16:03:52 CEST 2011


Author: jarioksa
Date: 2011-04-04 16:03:52 +0200 (Mon, 04 Apr 2011)
New Revision: 1570

Modified:
   pkg/vegan/R/metaMDSrotate.R
   pkg/vegan/inst/ChangeLog
   pkg/vegan/man/metaMDS.Rd
Log:
metaMDSrotate gained arg 'na.rm = FALSE'

Modified: pkg/vegan/R/metaMDSrotate.R
===================================================================
--- pkg/vegan/R/metaMDSrotate.R	2011-04-03 17:41:09 UTC (rev 1569)
+++ pkg/vegan/R/metaMDSrotate.R	2011-04-04 14:03:52 UTC (rev 1570)
@@ -1,6 +1,6 @@
 ### Rotates metaMDS result so that axis one is parallel to vector 'x'
 `metaMDSrotate` <-
-    function(object, vec, ...) 
+    function(object, vec, na.rm = FALSE, ...) 
 {
     if (!inherits(object, "metaMDS"))
         stop(gettextf("function works only with 'metaMDS' results"))
@@ -24,8 +24,12 @@
     ## vectorfit finds the direction cosine. We rotate first axis to
     ## 'vec' which means that we make other axes orthogonal to 'vec'
     ## one by one
+    if (na.rm)
+        keep <- !is.na(vec)
+    else
+        keep <- !logical(length(vec))
     for (k in 2:N) {
-        rot <- vectorfit(x[, c(1,k)], vec, permutations=0)$arrows
+        rot <- vectorfit(x[keep, c(1,k)], vec[keep], permutations=0)$arrows
         rot <- drop(rot)
         ## counterclockwise rotation matrix:
         ## [cos theta   -sin theta]

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2011-04-03 17:41:09 UTC (rev 1569)
+++ pkg/vegan/inst/ChangeLog	2011-04-04 14:03:52 UTC (rev 1570)
@@ -17,6 +17,9 @@
 	also handled in the R interface. The function will eventually
 	replace isoMDS() of the MASS package as the main NMDS engine in
 	metaMDS().
+
+	* metaMDSrotate: gained argument 'na.rm' (defaults FALSE) to
+	remove missing data from the continuous vector.
 	
 Version 1.18-27 (closed April 1, 2011)
 

Modified: pkg/vegan/man/metaMDS.Rd
===================================================================
--- pkg/vegan/man/metaMDS.Rd	2011-04-03 17:41:09 UTC (rev 1569)
+++ pkg/vegan/man/metaMDS.Rd	2011-04-04 14:03:52 UTC (rev 1570)
@@ -43,7 +43,7 @@
 postMDS(X, dist, pc=TRUE, center=TRUE, halfchange, threshold=0.8,
         nthreshold=10, plot=FALSE, ...)
 metaMDSredist(object, ...)
-metaMDSrotate(object, vec, ...)
+metaMDSrotate(object, vec, na.rm = FALSE, ...)
 }
 
 \arguments{
@@ -108,6 +108,7 @@
  \item{nthreshold}{ Minimum number of points in half-change scaling. }
  \item{object}{A result object from \code{metaMDS}.}
  \item{vec}{A continuous site variable (vector).}
+ \item{na.rm}{Remove missing values from continuous variable \code{vec}.}
  \item{...}{Other parameters passed to functions.}
 }
 \details{



More information about the Vegan-commits mailing list