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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Aug 20 10:12:52 CEST 2009


Author: jarioksa
Date: 2009-08-20 10:12:49 +0200 (Thu, 20 Aug 2009)
New Revision: 929

Modified:
   pkg/vegan/R/ordiellipse.R
   pkg/vegan/inst/ChangeLog
Log:
ordiellipse does not depend on the 'ellipse' package

Modified: pkg/vegan/R/ordiellipse.R
===================================================================
--- pkg/vegan/R/ordiellipse.R	2009-08-17 17:15:39 UTC (rev 928)
+++ pkg/vegan/R/ordiellipse.R	2009-08-20 08:12:49 UTC (rev 929)
@@ -3,7 +3,9 @@
               conf, draw = c("lines", "polygon"), w = weights(ord, display),
               show.groups, ...)
 {
-    require(ellipse) || stop("Requires package 'ellipse' (from CRAN)")
+    ## Define Circle for an ellipse: taken from the 'car' package
+    theta <- (0:51) * 2 * pi/51
+    Circle <- cbind(cos(theta), sin(theta))
     weights.default <- function(object, ...) NULL
     kind <- match.arg(kind)
     draw <- match.arg(draw)
@@ -32,15 +34,11 @@
             if (missing(conf))
                 t <- 1
             else t <- sqrt(qchisq(conf, 2))
+            xy <- t(mat$center + t * t(Circle %*% chol(mat$cov)))
             if (draw == "lines")
-                ordiArgAbsorber(ellipse(mat$cov, centre = mat$center, t = t),
-                      FUN = lines, ...)
-            else {
-                xy <- ellipse(mat$cov, center = mat$center, t = t)
-                ordiArgAbsorber(xy[, 1] + mat$center[1],
-                                xy[, 2] + mat$center[2],
-                                FUN = polygon, ...)
-            }
+                ordiArgAbsorber(xy, FUN = lines, ...)
+            else 
+                ordiArgAbsorber(xy[, 1], xy[, 2], FUN = polygon, ...)
         }
     }
     invisible()

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2009-08-17 17:15:39 UTC (rev 928)
+++ pkg/vegan/inst/ChangeLog	2009-08-20 08:12:49 UTC (rev 929)
@@ -4,6 +4,13 @@
 
 Version 1.16-24 (opened August 17, 2009)
 
+	* ordiellipse: does not depend on the 'ellipse' package, but finds
+	the coordinates of ellipse using the equation taken from the 'car'
+	package. However, this devel version of 'vegan' still must SUGGEST
+	'ellipse', because 'plot.MOStest' requires 'ellipse'. The current
+	release version does not include 'plot.MOStest' and could be
+	liberated from the 'ellipse' dependence.
+
 	* spantree: first argument 'd' like in hclust()instead of 'dis'.
 	Got a 'call' item so that update() works.
 



More information about the Vegan-commits mailing list