[Vegan-commits] r2154 - in branches/2.0: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun May 6 16:10:15 CEST 2012
Author: jarioksa
Date: 2012-05-06 16:10:15 +0200 (Sun, 06 May 2012)
New Revision: 2154
Modified:
branches/2.0/R/monoMDS.R
branches/2.0/R/rrarefy.R
branches/2.0/inst/ChangeLog
Log:
merge r2149 & r2150: rrarefy, drarefy and monoMDS check their input
Modified: branches/2.0/R/monoMDS.R
===================================================================
--- branches/2.0/R/monoMDS.R 2012-05-06 14:05:36 UTC (rev 2153)
+++ branches/2.0/R/monoMDS.R 2012-05-06 14:10:15 UTC (rev 2154)
@@ -91,6 +91,11 @@
}
## ndis: number dissimilarities
ndis <- length(dist)
+ ## some people try to use NMDS with too few points and too many
+ ## dimensions
+ if (ndis <= k * nobj)
+ stop(gettextf("Not enough data for NMDS: you have %d dissimilarities,\n and you ask %d scores (%d dimensions times %d points)",
+ ndis, k * nobj, k, nobj))
## starting configuration
if (missing(y)) {
y <- matrix(runif(nobj*k, -1, 1), nobj, k)
Modified: branches/2.0/R/rrarefy.R
===================================================================
--- branches/2.0/R/rrarefy.R 2012-05-06 14:05:36 UTC (rev 2153)
+++ branches/2.0/R/rrarefy.R 2012-05-06 14:10:15 UTC (rev 2154)
@@ -3,6 +3,8 @@
`rrarefy` <-
function(x, sample)
{
+ if (!identical(all.equal(x, round(x)), TRUE))
+ stop("function is meaningful only for integers (counts)")
x <- as.matrix(x)
if (ncol(x) == 1)
x <- t(x)
@@ -27,6 +29,8 @@
`drarefy` <-
function(x, sample)
{
+ if (!identical(all.equal(x, round(x)), TRUE))
+ stop("function accepts only integers (counts)")
if (length(sample) > 1 && length(sample) != nrow(x))
stop(gettextf(
"length of 'sample' and number of rows of 'x' do not match"))
Modified: branches/2.0/inst/ChangeLog
===================================================================
--- branches/2.0/inst/ChangeLog 2012-05-06 14:05:36 UTC (rev 2153)
+++ branches/2.0/inst/ChangeLog 2012-05-06 14:10:15 UTC (rev 2154)
@@ -4,6 +4,11 @@
Version 2.0-4 (opened March 9, 2012)
+ * merge r2150: monoMDS checks that the number of dissimilarities
+ is sufficient for the requested analysis. The decostand.Rd fix of
+ r2150 was not yet merged.
+ * merge r2149: drarefy & rrarefy check that input data are
+ integers.
* merge r2148 (partial): format references. However, scoverage()
was not merged yet, and its changes have not been merged.
* merge r2144: hiersimu and multipart do not assume constant
More information about the Vegan-commits
mailing list