disc_extract_deployments: Extract data for each deployment

Description Usage Arguments Details See Also Examples

View source: R/disc_extract_deployments.R

Description

Read the leg and deployment logs, read necessary data in the raw data directory, extract data for each deployment based on date and time.

Usage

1
2
disc_extract_deployments(raw = "raw", ids = NULL, deploy.dir = NULL,
  acclimation.time = 5, observation.time = 15, ...)

Arguments

raw

path to the directory where the raw data and the deployment and leg logs are; by default in a subdirectory called raw in the current directory.

ids

deployment identifiers to extract; if NULL (the default) extract all deployments.

deploy.dir

path to the directory containing deployments (and associated options). By default "deployments" in the current directory.

acclimation.time

duration of the acclimation time in minutes.

observation.time

duration of the observation period (after acclimation) in minutes.

...

passed to the various disc_extract methods for each sensor.

Details

To extract individual deployments from the raw leg data, disc_extract_deployments

  1. reads data (or descriptive metadata, such as start and stop time, number of records, etc.) from all sensors defined in the leg_log.csv file;

  2. synchronises all these records using the time offsets set in leg_log.csv;

  3. reads deployment_log.csv and extracts the data for each deployment based on the start and stop time.

To read data from a given sensor, disc_extract_deployments looks for an appropriate method for the generic function disc_read, i.e. a function named disc_read.nameofsensor. This function outputs a data.frame with at least one column called dateTime of class POSIXct used to account for the offset.

Similarly, to extract data from a given sensor for one deployment, disc_extract_deployments looks for an appropriate method for disc_extract. The default method deals with a data.frame with a column dateTime. Other methods can be defined for data that does not fit in a data.frame (video recordings, audio recodings, etc.)

To read and extract data from a new sensor, one just needs to define an appropriate method for disc_read and possibly disc_extract. See the help of these two functions to know more about tem

See Also

disc_read and disc_extract.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# get an example dataset included with the package
source <- system.file("extdata", "raw", package = "discr")
dest   <- tempdir()
disc_extract_deployments(raw=source, deploy.dir=dest, width=NULL,
                         acclimation.time=2, observation.time=2,
                         parallel=FALSE)
# NOTE:
# - the warning about deployment 2 being stopped earlier than the expected 2 mins
# - the notice that the compass (cc) has 0 records in deployment 2

system(paste0("ls -R ", dest))

jiho/discr documentation built on May 19, 2019, 9:30 a.m.