On 13/02/2012, at 20:23 PM, Edgar Torres wrote:
>> I am using CAPdiscrim function, but when I try to do the ordiplot it sends me an error message:
>> Erreur dans scores.default(ord, choices = choices, display = "sites") : indice hors limites (French)
> Error in scores.default(ord, choices = choices, display = "sites") : index out of range (English)
>>> I use a data frame where columns are species and rows are sites. And I have a data frame with "environmental" variables, but my interest is to compare between two sampling periods. As I have my data they work when I use adonis and/or betadisper functions in vegan, my code is very similar to that in the CAPdiscrim help.
> During each sampling period I have different sample size. May this affect the test?
>> Ordi <- CAPdiscrim(x1 ~ Prog, data=s1, dist="bray", axes=4, m=0, permutations=99)
> p1 <- ordiplot(Ordi)
>> ordisymbol(p1, s1, "Prog", legend=F)
>> where x1 is the abundance data frame and Prog is the factor for sampling periods.
>> When I see the results of Ordi I find only a vector of LD, and when I do the analysis with dune data there are two vectors
>Edgar,
The problem was that you asked two-dimensional plot of one-dimensional results, and vegan did not know how to handle this. It knows now: a commit to http://vegan.r-forge.r-project.org/ fixes this for vegan development version, and if no surprises arise, the fix will be in the next CRAN release.
You have only one axis in CAPdiscrim since your 'Prog' variable is a two-level factor. The maximum number of constrained axes with non-redundant factor constraints is the number of factor levels minus one. The ordiplot() function defaults to use two dimensions and requests those -- and oops! here we go (but this is now fixed).
An immediate solution is to request only one axis when there is only one axis: use argument 'choices':
p1 <- ordiplot(Ordi, choices=1)
Cheers, Jari Oksanen
--
Jari Oksanen, Dept Biology, Univ Oulu, 90014 Finland
jari.oksanen at oulu.fi, Ph. +358 400 408593, http://cc.oulu.fi/~jarioksa