## read in data and create a TDR object
(sealX <- readTDR(system.file(file.path("data", "dives.csv"),
package="diveMove"), speed=TRUE))
plotTDR(sealX) # pan and zoom through the record
## detect periods of activity, and calibrate depth, creating
## a 'TDRcalibrate' object
dcalib <- calibrateDepth(sealX) # interactively
(dcalib <- calibrateDepth(sealX, offset=3)) # zero-offset correct at 3 m
## plot all readings and label them with the phase of the record
## they belong to, excluding surface readings
plotTDR(dcalib, labels="phase.id", surface=FALSE)
## plot the first 300 dives, showing dive phases and surface readings
plotTDR(dcalib, diveNo=seq(300), labels="dive.phase", surface=TRUE)
## calibrate speed (using changes in depth > 1 m and default remaining arguments)
(vcalib <- calibrateSpeed(dcalib, z=1))
## Obtain dive statistics for all dives detected
dives <- diveStats(vcalib)
head(dives)
## Attendance table
att <- timeBudget(vcalib, FALSE) # taking trivial aquatic activities into account
att <- timeBudget(vcalib, TRUE) # ignoring them
## Add trip stamps to each dive
stamps <- stampDive(vcalib)
sumtab <- data.frame(stamps, dives)
head(sumtab)Run the code above in your browser using DataLab