Skip to contents

Select a portion of an glider object, specified according to one of several possible schemes, based on the form of the argument named subset. Note that the schemes cannot be combined, so nested calls must be used to accomplish combinations.

Usage

# S4 method for class 'glider'
subset(x, subset, ...)

Arguments

x

an oceglider object, i.e. one inheriting from the glider.

subset

a logical expression or a character string that indicates how to take the subset. See “Details”.

...

Additional arguments, of which the only one permitted at the moment is debug, an integer indicating the level of debugging information to be permitted.

Value

An oceglider object.

Details

Scheme 1: if subset is a logical expression written in terms of data that are stored in the yos, then this expression is applied to the payload1 item in the data slot of the object (see Example 1).

Scheme 2: if subset is a logical expression containing the word "yolength", then the expression is used as a filter to select yos based on the number of samples they contain (see Example 2). Typically, this might be used to avoid very short yos that might have been inferred erroneously by the glider instrumentation.

Scheme 3: If subset is the string "ascending", then only ascending segments of yos are retained. This is done by selecting for navState==117 in both the glider and payload1 streams of the data slot of the object.

Scheme 4: If subset is the string "descending", then only descending segments of yos are retained. This is done by selecting for navState==100 in both the glider and payload1 streams of the data slot of the object.

Bugs

The 'ascending' and 'descending' methods do not work. This seems to be a problem of exporting classes using roxygen2 tags. I am looking into this. DK 2019-03-28.

Author

Dan Kelley

Examples

if (FALSE) { # \dontrun{

# Example 1. remove wild salinities
library(oceglider)
g <- read.glider(filename)
gg <- subset(g, 0 < salinity & salinity < 40)
par(mfrow = c(2, 1))
hist(g[["salinity"]], main = "S original")
hist(gg[["salinity"]], main = "S cleaned")

# Example 2. remove short yos
gg <- subset(g, yolength > 4)

# Example 3. retain only ascending portions of yos
gascending <- subset(g, "ascending")

# Example 4. retain only descending portions of yos
gdescending <- subset(g, "descending")
} # }