[R-sig-eco] Negative Data Error with Decorana in Vegan
gavin.simpson at ucl.ac.uk
Tue Jul 20 02:49:38 CEST 2010
On Mon, 2010-07-19 at 17:35 -0700, Michele Tobias wrote:
> I'm fairly inexperienced with the Vegan package, so my apologies if I'm
> asking a very basic question. I'm trying to use the decorana function
> in the Vegan package. My data is all positive numbers but I get an
> error that says this:
> Error in decorana(dataord) :
> 'decorana' cannot handle negative data entries
> The data (dataord) is of class data.frame and originated from an SQLite
> database brought into R using the RSQLite package, just in case those
> details matter. I'm fairly sure that the numbers in the data frame are
> numbers and not text, but if they were text, would that cause the error?
No; decorana has a check for that:
dune[1,1] <- "10"
Error in rowSums(veg) : 'x' must be numeric
> Any ideas what is causing the problem or how to get around it? Thank you!
Yes; some of your data takes values less than 0 :-)
You might think the data are all positive, but I'm certain R doesn't
think so *after* it has been processed to a matrix within decorana.
Unless you provide evidence to the contrary (such as a reproducible
example, your data, or summary output from your data) then sort your
data out so that it doesn't contain negative values.
To help further, post the output of the following:
apply(as.matrix(dataord), 2, range)
which(dataord < 0)
As that is likely to point to the problem. Hopefully at that point
you'll see where the problem with your data is and can sort it out
yourself. If not, post the output from the above to the list and I'll
take a closer look for you.
Also, please post details of your session info:
The above examples were with:
R version 2.11.1 Patched (2010-07-18 r52561)
 LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
 LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
 LC_MONETARY=C LC_MESSAGES=en_GB.UTF-8
 LC_PAPER=en_GB.UTF-8 LC_NAME=C
 LC_ADDRESS=C LC_TELEPHONE=C
 LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
 stats graphics grDevices utils datasets methods
other attached packages:
loaded via a namespace (and not attached):
Note my vegan installation on my laptop is not quite up-to-date (1.17-3
is current) but there were no changes to decorana between my version and
the one on CRAN.
Dr. Gavin Simpson [t] +44 (0)20 7679 0522
ECRC, UCL Geography, [f] +44 (0)20 7679 0565
Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
More information about the R-sig-ecology