1

I am using vegan::rarecurve on community data.

lac.com.data<-wisconsin(lac.com.data)
rarecurve(lac.com.data)

Unfortunately, I am getting an error and cannot figure out how to fix it.

Error in seq.default(1, tot[i], by = step) : wrong sign in 'by' argument

I tried

 rarecurve(lac.com.data,step=1)

to no avail.

I already generated a tabasco() graph and performed a Wisconsin standardization on the data frame without any problem.

1

1 Answer 1

3

There is no reproducible example. However, your usage is wrong. Function rarecurve needs input data of counts: it samples individuals from each sampling unit (row), and therefore you must have data on individuals. The error is caused by the use of wisconsin(lac.com.data): after that all rowSums(lac.com.data) will be 1, and your data are non-integers. You cannot use rarecurve for wisconsin() transformed data or any other non-integer data. Here the error manifests because the estimated numbers of individuals (rowSums of transformed data which are all 1) are lower than the number of species (>1).

Obviously we need to check input in rarecurve. We assumed that people would know what kind input is needed, but we were wrong.

5
  • Thanks for the response Jari. I tried running it without the Wisconsin standardization (ie on a raw contingency matrix of integer counts) and ran into the same problem. Is there an efficient way to upload a large contingency table so that I can show what my lac.com.data dataframe looks like? Commented Jun 17, 2015 at 1:58
  • Nothing in your message points to the problems with the size of the input matrix. You really should try to make a minimal example that fails. I bet that if you make such a minimal example, you can identify the problem yourself. So please try. If you get exactly the same error message as in your matrix, then I see two potential problems: you really do have non-integer data, or you have empty observations (some rowSums are zero). If you got some other error message, then the problem may be different. I don't know because you don't tell. Commented Jun 17, 2015 at 6:37
  • Thank you. It was because I had a few rows that summed to zero. I wasn't suggesting that the size of the matrix was causing the function to fail. I merely wanted to show you the dataframe I was using that was causing the problem. However, I don't know/want to post a 51x54 dataframe on here and was asking, for future knowledge, how to do so in an efficient manner so that potential responders can see the input without having a large, awkwardly formatted dataframe in the text of my initial question. Commented Jun 17, 2015 at 12:14
  • I now see the link MrFlick linked to, which was very helpful. My one issue is to say that if I had merely selected some of the rows, or chosen appropriate data, then the error probably would not have appeared as it did when I ran the whole dataframe, given that only two rows were all zeros. Nevertheless, Jari was able to solve my problem. Thanks all. Commented Jun 17, 2015 at 12:21
  • Jari, I was hoping you could answer one more question since I have you and your wealth of knowledge here. I was hoping to use rarecurve() to see whether I had taken enough counts in different land management types. I currently have 5 types and 10 samples for each. Is there a way (arguments) to use rarecurve() (editing the the function itself) so that each management type is a separate line in the output graph, or will I have to sum each management type (so I only have 5 rows, 1 for each type) and then run 'rarecurve()' on that edited dataframe? Thanks. Commented Jun 17, 2015 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.