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:
require(vegan)
data(dune)
dune[1,1]<- "10"
decorana(dune)
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:
str(dataord)
sapply(dataord, range)
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:
sessionInfo()
The above examples were with:
R version 2.11.1 Patched (2010-07-18 r52561)
i686-pc-linux-gnu
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=C LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] vegan_1.17-2
loaded via a namespace (and not attached):
[1] tools_2.11.1
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.