joshwlambert / DAISIEprep

Extracts phylogenetic island community data from phylogenetic trees
https://joshwlambert.github.io/DAISIEprep
GNU General Public License v3.0
6 stars 3 forks source link

`sse_states_to_endemicity()` and `endemicity_to_sse_states()` are non-symmetrical #17

Closed joshwlambert closed 1 year ago

joshwlambert commented 1 year ago

I would expect sse_states_to_endemicity() and endemicity_to_sse_states() to reverse each others output. However, this is not the case.

endemicity_to_sse_states(endemicity_status = "nonendemic", sse_model = "geosse")

gives 0.

However

sse_states_to_endemicity(states = 0, sse_model = "geosse")

gives an error and says states should be 1, 2 or 3.

sse_states_to_endemicity(states = 3, sse_model = "geosse")

gives "0" (as a character) which is weird behaviour.

Perhaps all of this behaviour is intended. If so just let me know and we can document the functions to reflect that and I'll close the issue.

TheoPannetier commented 1 year ago

Sorry, I somehow missed this notification in January! Yes, both outputs are wrong,

endemicity_to_sse_states(endemicity_status = "nonendemic", sse_model = "geosse")

should return 0 (numeric) and

sse_states_to_endemicity(states = 3, sse_model = "geosse")

should throw an error, while

sse_states_to_endemicity(states = 0, sse_model = "geosse")

should return "nonendemic" (as of now it errors). Let me create some tests and fix the issue.

TheoPannetier commented 1 year ago

Fixed in #24