NCEAS / codyn

Community dynamics metrics
33 stars 8 forks source link

synchrony.R line 113 does not work as intended #126

Open jamiemkass opened 3 years ago

jamiemkass commented 3 years ago

I don't think this line actually subsets the species out with 0 abundance as intended because it needs the actual variable name from the table, not the parameter name. This line does though: df <- df[df[[abundance.var]]>0,] It doesn't seem to affect the output, but thought I'd bring it to your attention.

jamiemkass commented 3 years ago

I also thought that simply removing all records with 0 abundance wouldn't make much sense, because true absences would be essential to compute the true variance if there are other non-zero abundances in a time series for a species. I thought something like this, that removes species with ALL zeroes (the ones most likely not to vary over time) makes more sense. Curious what you think.

Qformula <- as.formula(paste(abundance.var, "~", species.var, sep = "")) spSums <- aggregate(Qformula, data = df, sum) spZeroes <- spSums[spSums$abundance==0, species.var] df <- df[!(df[[species.var]] %in% spZeroes),]

mbjones commented 3 years ago

@laurenmh @mavolio Could you comment on these proposed algorithmic changes to codyn please? Thanks!

mavolio commented 3 years ago

What function is this for?

On Thu, Jan 28, 2021 at 9:47 PM Matt Jones notifications@github.com wrote:

@laurenmh https://github.com/laurenmh @mavolio https://github.com/mavolio Could you comment on these proposed algorithmic changes to codyn please? Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NCEAS/codyn/issues/126#issuecomment-769537317, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADS3ZTAESHH3B6AY73R5YXTS4IOVPANCNFSM4WWRXLPQ .

mbjones commented 3 years ago

@mavolio synchrony.R line 113 (from the subject)