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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri May 21 10:08:32 CEST 2010


Author: jarioksa
Date: 2010-05-21 10:08:32 +0200 (Fri, 21 May 2010)
New Revision: 1189

Modified:
   pkg/vegan/R/ordiellipse.R
   pkg/vegan/inst/ChangeLog
Log:
ordiellipse works only in 2D and now checks that it has only 2D

Modified: pkg/vegan/R/ordiellipse.R
===================================================================
--- pkg/vegan/R/ordiellipse.R	2010-05-21 07:59:19 UTC (rev 1188)
+++ pkg/vegan/R/ordiellipse.R	2010-05-21 08:08:32 UTC (rev 1189)
@@ -11,6 +11,12 @@
     kind <- match.arg(kind)
     draw <- match.arg(draw)
     pts <- scores(ord, display = display, ...)
+    ## ordiellipse only works with 2D data (2 columns)
+    pts <- as.matrix(pts)
+    if (ncol(pts) > 2)
+        pts <- pts[ , 1:2, drop = FALSE]
+    if (ncol(pts) < 2)
+        stop("ordiellipse needs two dimensions")
     w <- eval(w)
     if (length(w) == 1)
         w <- rep(1, nrow(pts))

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2010-05-21 07:59:19 UTC (rev 1188)
+++ pkg/vegan/inst/ChangeLog	2010-05-21 08:08:32 UTC (rev 1189)
@@ -2,8 +2,16 @@
 
 VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
 
-Version 1.18-5 (opened May 21, 2010)
+Version 1.18-5 (opened May 21, 2010) 
 
+	* ordiellipse: works only with 2D data, and now uses only first
+	two dimensions of input if more given. For instance, the following
+	works now, but gave very cryptic error message previously:
+
+	m <- decorana(dune)
+	plot(m)
+	with(dune.env, ordiellipse(m, Management))
+
 	* ordiresids: removes now the row weights from Residuals and
 	Fitted in CA. Now shows the same values that are shuffled or
 	resampled in simulate.cca() where they are again weighted after



More information about the Vegan-commits mailing list