subset: Subset an Object

[.lcensR Documentation

Subset an Object

Description

Extracts or subsets a vector: methods for "lcens," "mcens," and "qw" data.

Usage

## S3 method for class 'lcens'
x[i, ...]

## S3 method for class 'mcens'
x[i, ...]

## S3 method for class 'qw'
x[i, ...]

## S3 method for class 'qw'
subset(x, subset, ...)

Arguments

x

any R object to subset.

i

index specifying elements to extract.

...

not used, required for other methods.

subset

an logical expression involving a slot name of the qw object.

Details

The values for i can be either numeric indexes or logical.
Valid slot names are "remark.codes," "reporting.level," "reporting.method," "reporting.units," "analyte.method," "analyte.name," and "unique.code."

Value

A subset of the object x.

Note

In general, assignment of specific values should not be done using the "[" extraction operator because it does not modify the meta data assiciated with a value. But any value can be set to NA by treating the value as a matrix and setting the equivalent of the row to NA. See the example below.

See Also

[.qw

Examples

Xcens <- as.lcens(c(1, 2, 3, 4), 2)
# Extract the 3rd value
Xcens[3]
# Change the 3rd value to NA and print the data
Xcens[3,] <- NA
Xcens

USGS-R/smwrQW documentation built on Oct. 11, 2022, 6:13 a.m.