Initially, colonization events are years when a species is present but wasn't in previous year, and extinction events are the first year a species is absent after being present. So in any given year, the two events were mutually exclusive. So for a given year and species, a -1 indicated extinction, a 1 indicated colonization.
I wanted extinction events to be marked as the last year a species was present before it left the region so that I could figure out which strata were the last occupied before the absence. So I shifted the extinction year back 1.
I did this shift when I was still using the single column -1/ 1 convention; so if a colonization was immediately followed by an extinction, the colonization got overwritten. Oops!
The solution is to switch to the 2-column format earlier in the code, before I do the year-shift.
https://github.com/rBatt/trawl/blob/development/trawlDiversity/R/get_colonizers.R#L39-L46
Initially, colonization events are years when a species is present but wasn't in previous year, and extinction events are the first year a species is absent after being present. So in any given year, the two events were mutually exclusive. So for a given year and species, a -1 indicated extinction, a 1 indicated colonization.
I wanted extinction events to be marked as the last year a species was present before it left the region so that I could figure out which strata were the last occupied before the absence. So I shifted the extinction year back 1.
I did this shift when I was still using the single column -1/ 1 convention; so if a colonization was immediately followed by an extinction, the colonization got overwritten. Oops!
The solution is to switch to the 2-column format earlier in the code, before I do the year-shift.
An example is "Pagurus trigonocheirus" is ai