[R-sig-eco] SIMPER problem: invalid 'nrow' value (too large or NA)

Jari Oksanen jari.oksanen at oulu.fi
Wed Oct 15 15:24:34 CEST 2014


On 14/10/2014, at 21:41 PM, mastratton wrote:

> markusvlindh wrote
>> Dear all,
>> 
>> I'm having difficulty applying a SIMPER analysis found in vegan, following
>> the example provided i the help function of simper. I keep receiving the
>> following error message: 
>> 
>> Error in matrix(ncol = P, nrow = n.a * n.b) : 
>>  invalid 'nrow' value (too large or NA)
>> 
>> My data consist of a community matrix with 200 species and 43 dates (class
>> = "data.frame") and my groups consists of factors with in total 12 levels.
>> 
>> A mock example could be the following that is working! :
>> library(vegan)
>> community<-data.frame(replicate(43,sample(0:1000,200,rep=TRUE)))
>> groups<-as.factor(replicate(1,sample(c("Alpha","Beta","Gamma","Epsilon","Bact","Actino","Verr","Unclass","Cyano","Plancto","Eury","Chloro"),200,rep=T))
>> simper_test<-simper(community,groups)
>> summary(simper_test)
>> 
>> But please see the attached files for true data that is not working.
>> 
>> Could someone please please assist in what is the problem with my data.
>> 
>> Kind regards!
> 
> Markus,
> 
> I was getting the same error message and discovered that simper() is not
> written to handle an input 'group' factor that has one or more unique values
> with only one occurrence. Your data (reattached) have two of these
> instances:.
> 
...
> The source code for simper() can be modified to allow these instances:
> 
Yes, the source can be modified *and* it has been modified to cope with one-member groups. You can install the modified version of vegan for Windows, or if you have programming tools for other OS's, too, using: 

install.packages("vegan", repos="http://R-Forge.R-project.org")

This is development version, but we are going to release new CRAN version of vegan later this month, and the R-Forge version is very close to the release version. (Looks like the build system is down again in R-Forge, and has been for a week, so that this is not the most recent and stable version of R-Forge, but it is mostly safe.)

Cheers, Jari Oksanen



More information about the R-sig-ecology mailing list