Amelia J. MacDonald
Encounter histories are a common format for analyzing mark-resight data. Shorebird flag resighting data are
often submitted to BandedBirds.org, an international database of shorebird resightings along the Atlantic
Flyway. However, data formatted for submission to BandedBirds.org are not arranged in encounter histories, nor
is the format commonly used for analysis in R. Especially when working with large datasets, automating the
process of transforming resighting data submitted to BandedBirds.org into encounter histories can save time
and reduce errors. bb2enchist
provides functions that facilitate this process.
bb2enchist
can be installed by installing the devtools
package (if not already installed) and using the following code:
devtools::install_github("ajmacdonald3/bb2enchist")
Inputs:
- A CSV file of resighting data formatted exactly as submitted to BandedBirds.org
- A CSV file assigning each date within the study to a resighting period (optional - this is only necessary if setting custom resighting periods)
Outputs:
- A dataframe with encounter histories formatted for further analysis in R that can also be exported as a CSV file
- A dataframe with encounter histories formatted for analysis in Program MARK that can be exported as an INP (text) file
format_bandedbirds()
: This function takes a dataframe formatted exactly as submitted to BandedBirds.org and returns a dataframe with columns for ResightDate and FlagID (a combination of flag colour and code). This function can parse out one or more species of interest while excluding species that are not of interest. You can keep only resights where certainty was 95% or greater (noted as C for BandedBirds.org). If resight certainty was not consistently recorded, you can keep all resights with complete codes and filter them yourself, if desired.
set_period()
: This function takes the dataframe generated by format_bandedbirds()
and converts ResightDate into ResightPeriod, which can be a common unit of time (i.e. year, month, week, 3 days). If your resighting period is a single day and your data have at least one observation per day within the study, this function is not required.
custom_period()
: If your resighting periods are unequal or do not fall into a common time unit, this function allows you to merge the dataframe generated by format_bandedbirds()
with a dataframe that has columns for ResightDate and ResightPeriod (generally imported as a CSV file).
create_enchist()
: This function takes the dataframe generated by format_bandedbirds()
and set_period()
if necessary and transforms the resighting data into encounter histories. Each row represents an individual bird resighted during the study, which is assigned a 1
in every resighting period it was seen and a 0
in every resighting period it was not seen.