[Vegan-commits] r2828 - in pkg/vegan: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jan 7 18:16:40 CET 2014
Author: jarioksa
Date: 2014-01-07 18:16:40 +0100 (Tue, 07 Jan 2014)
New Revision: 2828
Modified:
pkg/vegan/R/ordiellipse.R
pkg/vegan/R/veganCovEllipse.R
pkg/vegan/inst/ChangeLog
Log:
ordiellipse handles two or more points strictly on line
Modified: pkg/vegan/R/ordiellipse.R
===================================================================
--- pkg/vegan/R/ordiellipse.R 2014-01-07 08:38:33 UTC (rev 2827)
+++ pkg/vegan/R/ordiellipse.R 2014-01-07 17:16:40 UTC (rev 2828)
@@ -37,7 +37,7 @@
kk <- complete.cases(pts)
for (is in inds) {
gr <- out[groups == is & kk]
- if (length(gr) > 2) {
+ if (length(gr) > 1) {
X <- pts[gr, ]
W <- w[gr]
mat <- cov.wt(X, W)
Modified: pkg/vegan/R/veganCovEllipse.R
===================================================================
--- pkg/vegan/R/veganCovEllipse.R 2014-01-07 08:38:33 UTC (rev 2827)
+++ pkg/vegan/R/veganCovEllipse.R 2014-01-07 17:16:40 UTC (rev 2828)
@@ -5,5 +5,8 @@
theta <- (0:npoints) * 2 * pi/npoints
Circle <- cbind(cos(theta), sin(theta))
## scale, center and cov must be calculated separately
- t(center + scale * t(Circle %*% chol(cov)))
+ Q <- chol(cov, pivot = TRUE)
+ ## pivot takes care of cases when points are on a line
+ o <- attr(Q, "pivot")
+ t(center + scale * t(Circle %*% Q[,o]))
}
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2014-01-07 08:38:33 UTC (rev 2827)
+++ pkg/vegan/inst/ChangeLog 2014-01-07 17:16:40 UTC (rev 2828)
@@ -11,6 +11,15 @@
be used in an incorrect context". The dots were added in r2765,
and now removed.
+ * ordiellipse: failed if all points were on a line. Now handles
+ these cases by drawing a line trhough the points, and issuing a
+ warning from chol(): "the matrix is either rank-deficient or
+ indefinite". Earlier we required at least three points for an
+ ellipse, but these could still be on a line and fail. Now we
+ accept two points, and draw the line with a warning. The problem
+ with three points was reported by Paul Bacquet (Louvain,
+ Belgium).
+
* BCI: names checked after http://www.theplantlist.org, but kept
the old (alphabetic) order of species. The changes are: Abarema
macradenium -> A. macradenia, Apeiba aspera -> A. glabra,
More information about the Vegan-commits
mailing list