[Vegan-commits] r1430 - in pkg/vegan: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jan 3 12:32:30 CET 2011
Author: jarioksa
Date: 2011-01-03 12:32:29 +0100 (Mon, 03 Jan 2011)
New Revision: 1430
Modified:
pkg/vegan/R/wascores.R
pkg/vegan/inst/ChangeLog
Log:
wascores checks its input
Modified: pkg/vegan/R/wascores.R
===================================================================
--- pkg/vegan/R/wascores.R 2010-12-31 15:17:36 UTC (rev 1429)
+++ pkg/vegan/R/wascores.R 2011-01-03 11:32:29 UTC (rev 1430)
@@ -1,6 +1,8 @@
`wascores` <-
function (x, w, expand = FALSE)
{
+ if(any(w < 0) || sum(w) == 0)
+ stop("weights must be non-negative and not all zero")
x <- as.matrix(x)
w <- as.matrix(w)
nc <- ncol(x)
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2010-12-31 15:17:36 UTC (rev 1429)
+++ pkg/vegan/inst/ChangeLog 2011-01-03 11:32:29 UTC (rev 1430)
@@ -10,6 +10,9 @@
* CCorA: Pierre Legendre's minor fixes, including scaling of
scores Cy an Cx, and removing requirement of MASS.
+ * wascores: checks input -- weights (species abundances) must be
+ non-negative and not all zero.
+
* metaMDS: function was written for community data with all
entries non-negative, but it is used increasingly often with other
data types with a risk of failure (especially in wascores()). Now
More information about the Vegan-commits
mailing list