0

I'm trying to use the function variance_ratio() from the 'codyn' package to find whether two populations' abundances are positively or negatively correlated over time. The column I'm using for species.var isn't actually the species names; it's names for the two populations. For replicate.var, I am using a variable called "siteyear."

When I try to find the variance ratio, I'm getting the error message

"Error in check_multispp(df, species.var, replicate.var): One or more replicates consists of only a single species; please remove these replicates prior to calculations."

I assume this error means that one of the "species" is not found at all in some of the replicates, making its abundance always zero. However, I checked and all the site-years have abundance >0 for both "species", for at least one time point. There are some time points where one population has 0 abundance, but I don't see why that should be an issue.

IRTFM
  • 258,963
  • 21
  • 364
  • 487
  • 1
    It's impossible to help without seeing (sample) data and code. Please edit your post to include *representative* and *minimal* sample data along with those parts of your code that reproduces the issue. Take a look at [How to make a great R reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) to understand what's required for a good reprex. – Maurits Evers Jun 27 '22 at 22:38

1 Answers1

0

In trying to create minimal sample data that would replicate the error, I managed to figure out the cause. There were some replicates in my data frame with only one value for time.var (the time series had just one time point). This was flagged by the function check_multispp(), which is supposed to check whether the time series has more than one species, but the error message was slightly misleading.