loadDetectionData: Load Detection Data

View source: R/loadDetectionData.R

loadDetectionDataR Documentation

Load Detection Data

Description

Loads and formats detection data into a common format for use in other PAMscapes functions

Usage

loadDetectionData(
  x,
  source = c("makara", "csv"),
  columnMap = NULL,
  detectionType = c("auto", "presence", "detection"),
  presenceDuration = NULL,
  dateFormat = c("%Y-%m-%dT%H:%M:%S+0000", "%Y-%m-%d %H:%M:%S",
    "%m-%d-%Y %H:%M:%S", "%Y/%m/%d %H:%M:%S", "%m/%d/%Y %H:%M:%S"),
  tz = "UTC",
  wide = FALSE,
  speciesCols = NULL,
  detectedValues = NULL,
  extraCols = NULL,
  ...
)

Arguments

x

dataframe or path to CSV file containing detection data

source

source of the detection data, choices other than "csv" just specify specific formatting options

columnMap

a list or data.frame specifying how to map the input column names to the required standard names of "UTC", "end", and "species". If a list, must be a named list where the names are the standardized column names and the values are the existing names, e.g. list('UTC'='start', 'species'='SpeciesName'). If a data.frame, must have columns "old" with the existing column names and "new" with the standardized name to change it to. All columns successfully changed will be kept with the output

detectionType

one of "auto", "presence", or "detection" specifying the type of detection in the data. "presence" means hourly or daily presence style of detections - the duration of the detection is used for the time unit (e.g. hourly presence might have "UTC" value 2020-01-01 12:00:00 and "end" value 2020-01-01 13:00:00 for a detection). "detection" means the data refer to specific detections or bouts of detections rather than just presence. "auto" means that the type of detection will be inferred from the start and end time of each detection - any detections with a duration of exactly one hour or exactly one day will be marked as "presence", any other duration will be marked as "detection"

presenceDuration

if detectionType='presence', the duration in seconds, e.g. 86400 for daily presence. Alternative can be a character of the form "(NUMBER)(DURATION)" e.g "2hour" or "1day"

dateFormat

format string of dates, see strptime. Can be a vector of multiple formats

tz

time zone of input data

wide

logical flag indicating whether the input data has species detection information in wide (instead of long) format. If TRUE, then this means that there are multiple columns representing multiple kinds of detections, e.g. one column for each different species present. If FALSE, then there is a single column that indicates what kind of detection it is.

speciesCols

only used if wide=TRUE, the names of the columns containing the different types of detections

detectedValues

only used if wide=TRUE, the values in each speciesCols column that indicate a positive detection. e.g. if "0" represents no detection and "1" represents a detection, then this should be "1". Note that all values will be converted to characters, so the string "1" must be used instead of the numeric 1

extraCols

(optional) any additional columns to keep with the output

...

additional arguments used for certain source values

Value

a dataframe with columns UTC, end, species, and detectionType, where each row represents a single detection event. May have additional columns depending on other parameters

Author(s)

Taiki Sakai taiki.sakai@noaa.gov


PAMscapes documentation built on April 4, 2025, 2:17 a.m.