extractSites: Extract Sites

View source: R/extractSites.R

extractSitesR Documentation

Extract Sites

Description

The function takes complete capture histories downloaded from PTAGIS and extracts all the detection sites from them. It matches those sites with information from PTAGIS metadata, being sure to pull the metadata from the correct configuration file.

Usage

extractSites(
  cth_file = NULL,
  file_type = c("PTAGIS", "Biologic_csv", "raw"),
  as_sf = F,
  crs = 5070,
  min_date = NULL,
  max_date = NULL,
  configuration = NULL
)

Arguments

cth_file

is the path to the complete tag history file

file_type

describes the source of the complete tag history file.

If PTAGIS, then cth_file should be a PTAGIS observation file downloaded as a csv from PTAGIS. This must be the output from a Complete Tag History query (part of the Advanced Reporting). This query should contain: Tag, Mark Species, Mark Rear Type, Event Type, Event Site Type, Event Site Code, Event Date Time, Antenna, Antenna Group Configuration, Event Release Site Code, and Event Release Date Time.

If Biologic_csv, that implies the data was downloaded from Biologic software in a .csv format.

If raw, that implies the data was downloaded directly from the reader, in either a .log or .xlsx format. In this case, the largest string containing alphabetic characters in the file name will be assigned as the site code.

as_sf

Should the results be returned as an 'sf' object ('TRUE'), or a tibble ('FALSE', and the default)?

crs

if 'as_sf = TRUE', what CRS should the resulting 'sf' object be transformed to? Default is 5070.

min_date

character in the format 'YYYYMMDD' that describes a minimum detection date. If supplied, sites with detections prior to this date will be excluded from the results.

max_date

character in the format 'YYYYMMDD' that describes a maximum detection date. If supplied, sites with detections after this date will be excluded from the results.

configuration

is a data frame which assigns node names to unique site, antenna, and site configuration ID combinations. One example can be built with the function 'buildConfig'. If no configuration file is provided, nodes are considered site codes by default. If nodes are assigned, the column name should be 'node'.

Value

a tibble

Author(s)

Kevin See

Examples

ptagis_file = system.file("extdata", "TUM_Chinook_2015.csv", package = "PITcleanr", mustWork = TRUE)
ptagis_cth = readCTH(ptagis_file)
extractSites(ptagis_cth)

KevinSee/PITcleanr documentation built on Feb. 27, 2024, 11:03 p.m.