Learn R Programming

wq (version 0.4.8)

WqData-class: Class "WqData"

Description

A simple extension or subclass of the "data.frame" class for typical “discrete” water quality monitoring programs that examine phenomena on a time scale of days or longer. It requires water quality data to be in a specific “long” format, although a generating function wqData can be used for different forms of data.

Arguments

Objects from the Class

Objects can be created by calls of the form new("WqData", d), where d is a data.frame. d should have columns named time, site, depth, variable, value of class "DateTime", "factor", "numeric", "factor", "numeric", respectively.

Slots

.Data:
Object of class "data.frame" as described above
Automatically created slots:
names:
Object of class "character" containing the names of the original data.frame.
row.names:
Object of class "data.frameRowLabels" containing the row names of the original data.frame.
.S3Class:
Object of class "character" describing which S3 class is extended by this class.

Extends

Class "data.frame", directly. Class "list", by class "data.frame", distance 2. Class "oldClass", by class "data.frame", distance 2. Class "vector", by class "data.frame", distance 3.

Methods

[
signature(x = "WqData"): x[i, ] Extracts a subset of the data, based on either row numbers or a logical expression involving the columns (time, site, depth, variable, value). The returned value is also a WqData object.
plot
signature(x = "WqData"): plot(x, vars, num.col = NULL) Multiple plots, each containing boxplots of data at each site for the same variable. An argument vars can be given specifying a character string of variables to be plotted. Otherwise, only the first 10 variables will be plotted if the number of variables is more than 10. The number of columns plotted is determined automatically unless num.col is given an integer value.
summary
signature(x = "WqData"): summary(x) Date range, number of observations for each combination of site and variable, and quartiles of variable values.
tsMake
signature(x = "WqData"): see tsMake,WqData-method

See Also

DateTime-class, tsMake,WqData-method, wqData

Examples

Run this code
showClass("WqData")
# Construct the WqData object sfb as shown in the wqData examples.
sfb <- wqData(sfbay, c(1,3,4), 5:12, site.order = TRUE, type = "wide", 
              time.format = "%m/%d/%Y")
# Summarize the data
summary(sfb)
# Create boxplot summary of data
plot(sfb, vars = c('chl', 'dox', 'spm'), num.col = 2)
# Extract some of the data as a WqData object
sfb[1:10,]  # first 10 observations
sfb[sfb$depth==20,]  # all observations at 20 m

Run the code above in your browser using DataLab