[R] error of betadiver in vegan
David Winsemius
dwinsemius at comcast.net
Fri Jul 12 18:02:56 CEST 2013
On Jul 12, 2013, at 1:47 AM, Elaine Kuo wrote:
> Hello,
>
> Thanks for Jari's comment.
> It worked well after correction.
> However, an error jumped out for the code below.
> "Error: cannot allocate vector of size 90.6 Mb"
>
> Please kindly advise how to modify it.
Elaine;
This problem has literally been addressed hundreds of times on R-help:
http://markmail.org/search/?q=list%3Aorg.r-project.r-help+%22Error%3A+cannot+allocate+vector+of+size%22
And it's either been asked or answered 54 times on StackOverflow:
http://stackoverflow.com/search?q=[r]+%22Error%3A+cannot+allocate+vector+of+size%22
Th lack of contiguous RAM is small enought that the problem should be manageable after reading a few of the solutions offered.
--
David.
> Thank you.
>
> Elaine
>
> Code
> # Non-Passerine table
> dataNP_1 <-read.dbf("H:/temp_D/stage_4_R_2748/NP_1-10.dbf", as.is = FALSE)
> dataNP_2 <-read.dbf("H:/temp_D/stage_4_R_2748/NP_11-19.dbf", as.is = FALSE)
> dataNP<-merge(dataNP_1,dataNP_2,by=c("GID"),all=T)
>
> .. skip...
>
> # Non-Passerine and Passerine table (2748 species)
> dataR<-merge(dataP,dataNP,by=c("GID"),all=T)
> dim(dataR)
> str(dataR)
>
> library(vegan)
>
> ## The beta sim index (Lennon 2001)
> d <- betadiver(dataR, "sim")
>
>
> On Fri, Jul 12, 2013 at 2:13 PM, Jari Oksanen <jari.oksanen at oulu.fi> wrote:
>
>> Elaine Kuo <elaine.kuo.tw <at> gmail.com> writes:
>>
>>>
>>> Hello,
>>>
>>> I am using betadiver (vegan) to calculate beta diversity.
>>> However, an error message shows
>>>
>>> Error in ifelse(x > 0, 1, 0) :
>>> (list) object cannot be coerced to type 'double'
>> ...snip...
>>
>>> ## Raw data
>>> R <- betadiver(dataR)
>>>
>>> ## The indices
>>> betadiver(help=TRUE)
>>>
>>> ## The beta sim index (Lennon 2001)
>>> d <- betadiver(R, "sim")
>>>
>> Elaine,
>>
>> Look carefully what you do here: betadiver needs data as input -- not beta
>> diversities. Your last command is equal to this oneliner:
>>
>> d <- betadiver(betadiver(dataR), "sim")
>>
>> This is guaranteed to fail. Use instead
>>
>> d <- betadiver(dataR, "sim")
>>
>> Cheers, Jari Oksanen
--
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list