Closed rasmus87 closed 6 months ago
Thank you for the useful comment. Nice that you made the test and the suggestion.
This was a bug in both the RIs and the RFCs code.
Thank you for a very quick fix. I think I was a little quick:
The mutate
should of course be dplyr::mutate
, to avoid mistakes.
Also, RFCs worked as it should already. the "fix" introduced an error. It should be divided by "N" (all interviewees), not by max(FC). RFCs(max) and RFCs are not that related, which is a bit confusing from the paper.
I think I managed to catch the bugs now. Please let me know if you find anything else. CRAN is on vacation now but I will try to get the latest working code on the CRAN after January 4th (when they are back). Hope this works in time for your course. Please share any course materials etc. Would be nice to see how this is being taught.
Cool, thanks. I will let you know if I catch anything else. I am not going though everything, just calculating some of the indices "by hand" for teaching purposes - and if they don't produce the same results I'll notice. I will send you the materials when they are done.
The code doesn't seem to calculate the Relative Importance Index as in the paper you cite.
I think the RFCs(max) part of the code is wrong.
Your code says:
RFCs <- RFCdata %>% dplyr::group_by(sp_name) %>% dplyr::summarize(RFCs = sum(FCps/(length(unique(informant))))) %>% dplyr::arrange(-RFCs)
Which gives
FCs
over total number of informants not over themax(FCs)
. There are 20unique
informants for all species in the test dataset, even though not all of them mention all species.For the test dataset your code gives this:
while the RI should be:
I have spent some time trying to understand this discrepancy. If I have misunderstood the paper or your function please let me know. I am teaching a course next month using your package and before i confuse my students too much, I would like to know if I'm mistaken or the package has a bug.
If I am right your code could read: