Skip to contents

Return a subset of a ctd object.

Usage

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

Arguments

x

a ctd object.

subset

An expression indicating how to subset x.

...

optional arguments, of which only the first is examined. The only possibility is that this argument be named indices. See “Details”.

Value

A ctd object.

Details

This function is used to subset data within a ctd object. There are two ways of working. If subset is supplied, then it is a logical expression that is evaluated within the environment of the data slot of the object (see Example 1). Alternatively, if the ... list contains an expression defining indices, then that expression is used to subset each item within the data slot (see Example 2).

Author

Dan Kelley

Examples

library(oce)
data(ctd)
plot(ctd)

# Example 1
plot(subset(ctd, pressure < 10))

# Example 2
plot(subset(ctd, indices = 1:10))