Learn R Programming

diveMove (version 1.4.1)

TDRcalibrate-accessors: Methods to Show and Extract Basic Information from "TDRcalibrate" Objects

Description

Show and extract information from TDRcalibrate objects.

Usage

"getDAct"(x) "getDAct"(x, y) "getDPhaseLab"(x) "getDPhaseLab"(x, diveNo) "getDiveModel"(x) "getDiveModel"(x, diveNo) "getDiveDeriv"(x, phase=c("all", "descent", "bottom", "ascent")) "getDiveDeriv"(x, diveNo, phase=c("all", "descent", "bottom", "ascent")) "getGAct"(x) "getGAct"(x, y) "getSpeedCoef"(x) "getTDR"(x)

Arguments

x
TDRcalibrate object.
diveNo
numeric vector with dive numbers to extract information from.
y
string; “dive.id”, “dive.activity”, or “postdive.id” in the case of getDAct, to extract the numeric dive ID, the factor identifying activity phases (with underwater and diving levels possibly represented), or the numeric postdive ID, respectively. In the case of getGAct it should be one of “phase.id”, “activity”, “begin”, or “end”, to extract the numeric phase ID for each observation, a factor indicating what major activity the observation corresponds to (where diving and underwater levels are not represented), or the beginning and end times of each phase in the record, respectively.
phase
character vector indicating phase of the dive for which to extract the derivative.

Value

elements of the slot they extracted.

Show Methods

show
signature(object="TDRcalibrate"): prints an informative summary of the data.
show
signature(object="diveModel"): prints an informative summary of a dive model.

Extractor Methods

getDAct
signature(x="TDRcalibrate", y="missing"): this accesses the dive.activity slot of TDRcalibrate objects. Thus, it extracts a data frame with vectors identifying all readings to a particular dive and postdive number, and a factor identifying all readings to a particular activity.
getDAct
signature(x="TDRcalibrate", y="character"): as the method for missing y, but selects a particular vector to extract. See TDRcalibrate for possible strings.
getDPhaseLab
signature(x="TDRcalibrate", diveNo="missing"): extracts a factor identifying all readings to a particular dive phase. This accesses the dive.phases slot of TDRcalibrate objects, which is a factor.
getDPhaseLab
signature(x="TDRcalibrate", diveNo="numeric"): as the method for missing y, but selects data from a particular dive number to extract.
getDiveModel
signature(x="TDRcalibrate", diveNo="missing"): extracts a list with all dive phase models. This accesses the dive.models slot of TDRcalibrate objects.
getDiveModel
signature(x="TDRcalibrate", diveNo="numeric"): as the method for missing diveNo, but selects data from a particular dive number to extract.
getDiveDeriv
signature(x="TDRcalibrate"): extracts the derivative (list) of the dive model (smoothing spline) from the dive.models slot of TDRcalibrate objects for one or all phases of a dive.
getDiveDeriv
signature(x="diveModel"): as the method for TDRcalibrate, but selects data from one or all phases of a dive.
getGAct
signature(x="TDRcalibrate", y="missing"): this accesses the gross.activity slot of TDRcalibrate objects, which is a named list. It extracts elements that divide the data into major wet and dry activities.
getGAct
signature(x="TDRcalibrate", y="character"): as the method for missing y, but extracts particular elements.
getTDR
signature(x="TDRcalibrate"): this accesses the tdr slot of TDRcalibrate objects, which is a TDR object.
getSpeedCoef
signature(x="TDRcalibrate"): this accesses the speed.calib.coefs slot of TDRcalibrate objects; the speed calibration coefficients.

See Also

diveModel, plotDiveModel, plotTDR.

Examples

Run this code

## Continuing the Example from '?calibrateDepth':
utils::example("calibrateDepth", package="diveMove",
               ask=FALSE, echo=FALSE)
dcalib		# the 'TDRcalibrate' that was created

## Beginning times of each successive phase in record
getGAct(dcalib, "begin")

## Factor of dive IDs
dids <- getDAct(dcalib, "dive.id")
table(dids[dids > 0])		# samples per dive

## Factor of dive phases for given dive
getDPhaseLab(dcalib, 19)
## Full dive model
(dm <- getDiveModel(dcalib, 19))
str(dm)

## Derivatives
getDiveDeriv(dcalib, diveNo=19)
(derivs.desc <- getDiveDeriv(dcalib, diveNo=19, phase="descent"))
(derivs.bott <- getDiveDeriv(dcalib, diveNo=19, phase="bottom"))
(derivs.asc <- getDiveDeriv(dcalib, diveNo=19, phase="ascent"))
if (require(lattice)) {
    fl <- c("descent", "bottom", "ascent")
    bwplot(~ derivs.desc$y + derivs.bott$y + derivs.asc$y,
           outer=TRUE, allow.multiple=TRUE, layout=c(1, 3),
           xlab=expression(paste("Vertical rate (", m %.% s^-1, ")")),
           strip=strip.custom(factor.levels=fl))
}

Run the code above in your browser using DataLab