[R] error of betadiver in vegan

Jari Oksanen jari.oksanen at oulu.fi
Fri Jul 12 08:13:58 CEST 2013


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



More information about the R-help mailing list