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. 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.oksa...@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 > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.