Hello List,
I solved the problem by using the code with 31 votes
http://stackoverflow.com/questions/1358003/tricks-to-manage-the-available-memory-in-an-r-session
On Sat, Jul 13, 2013 at 6:15 AM, Elaine Kuo <elaine.kuo.tw@gmail.com>
wrote:
> Hello List,
>
> This is Elaine.
> I am running betadiver for a dataset of 4873 rows and 2749 columns.
> (4873 rows = 4873 gridcell of the study region and 2749 columns for the
> bird species)
> The dataset was produced by combing 5 dbf.
>
> When running the code o, an error message jumped out, saying
> "Error: cannot allocate vector of size 90.6 Mb"
>
> I posted the issue in r-help and checked the previous mails about R memory
> problems.
> gc() and save .Rdata were tried but did not work.
> Also, I tried to transformed the dataset into a matrix, using the code m
> below.
> However, an error also appeared, saying
> "Error in ifelse(x > 0, 1, 0) :
> (list) object cannot be coerced to type 'double'."
>
> Please kindly advise how to alleviate the memory problem, particularly in
> modifying the code of betadiver of vegan.
> Thank you.
>
> Elaine
>
> code m
> matrixR<-matrix(data = dataR, nrow = 4873, ncol = 2749)
> d <- betadiver(matrixR, "sim")
>
>
>
> code o
> # 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")
>
[[alternative HTML version deleted]]