[Vegan-commits] r2484 - in pkg/vegan: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Apr 7 08:00:58 CEST 2013
Author: jarioksa
Date: 2013-04-07 08:00:57 +0200 (Sun, 07 Apr 2013)
New Revision: 2484
Modified:
pkg/vegan/R/betadisper.R
pkg/vegan/inst/ChangeLog
Log:
betadisper(..., type = 'centroid') failed when there was only one group
Modified: pkg/vegan/R/betadisper.R
===================================================================
--- pkg/vegan/R/betadisper.R 2013-03-19 14:22:26 UTC (rev 2483)
+++ pkg/vegan/R/betadisper.R 2013-04-07 06:00:57 UTC (rev 2484)
@@ -92,11 +92,13 @@
## Uses in-line Resids function as we want LAD residuals for
## median method, and LSQ residuals for centroid method
dist.pos <- Resids(vectors[, pos, drop=FALSE],
- centroids[group, pos, drop=FALSE])
+ if (is.vector(centroids)) centroids[pos]
+ else centroids[group, pos, drop=FALSE])
dist.neg <- 0
if(any(!pos))
dist.neg <- Resids(vectors[, !pos, drop=FALSE],
- centroids[group, !pos, drop=FALSE])
+ if (is.vector(centroids)) centroids[!pos]
+ else centroids[group, !pos, drop=FALSE])
## zij are the distances of each point to its group centroid
zij <- sqrt(abs(dist.pos - dist.neg))
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2013-03-19 14:22:26 UTC (rev 2483)
+++ pkg/vegan/inst/ChangeLog 2013-04-07 06:00:57 UTC (rev 2484)
@@ -4,6 +4,10 @@
Version 2.1-28 (opened March 17, 2013)
+ * betadisper: failed with type = "centroid" when there was only
+ one group (i.e., in estimating the overall beta diversity in the
+ data). Reported by Pierre Legendre.
+
* rda: eigenvalues are now regarded as zero if they are very small
compared to the first eigenvalue. Earlier we used fixed limit of
1e-4, but now the limit is first eigenvalues * 1e-5. Similar
More information about the Vegan-commits
mailing list