[R-sig-eco] rarefaction not working with the min species number
Jari Oksanen
jari.oksanen at oulu.fi
Tue Apr 24 15:01:16 CEST 2012
On 24/04/2012, at 15:39 PM, Stephen Sefick wrote:
> I will provide reproducible code if I need to.
>
> All:
>
> I am trying to set up a 1000 pulls of a community data frame for calculating richness measures. I would like to be able to code the sample number based on the minimum of all of the samples. I can do this but there is an error:
>
> Error in sample(rep(nm, times = x[i, ]), sample[i]) :
> cannot take a sample larger than the population when 'replace = FALSE'
>
> when using:
>
> rrarefy(L, min(apply(L, 1, sum)))
>
> min is returning the lowest sample abundance of all of the samples. rrarefy works if I subtract 5 (arbitrary) from the min(...) statement. I am sure that I am missing something simple.
> many thanks,
>
Stephen,
I can reproduce this if input data ('L') contain non-integer data. The function is only able to handle integer data, but it does not check the input. Probably it should: the error would still be there, but the message would be more informative.
Cheers, Jari
--
Jari Oksanen, Dept Biology, Univ Oulu, 90014 Finland
More information about the R-sig-ecology
mailing list