Learn R Programming

wq (version 0.2-9)

tsMake: Create time series from water quality data

Description

Creates a matrix time series object from an object of class "WqData", either all variables for a single site or all sites for a single variable.

Usage

## S3 method for class 'WqData':
tsMake(object, focus, layer, type = c("ts.mon", "zoo"))

Arguments

Value

A matrix of class "mts" or "zoo".

Rdversion

1.1

Details

The function currently averages all included depths for each day, the implicit assumption being that the layer is well-mixed and/or the samples are evenly distributed with depth in the layer. It produces a matrix time series of all variables for the specified site or all sites for the specified variable. A monthly time series is produced, from which a quarterly or annual series can be created if needed. If no layer is specified, all depths will be used. If you want values for the actual dates of observation, then set type = "zoo".

See Also

WqData-class

Examples

Run this code
# Create new WqData object
sfb <- wqData(sfbay, c(1, 3:4), 5:12, site.order = TRUE, 
         time.format = "%m/%d/%Y", type = "wide")

y <- tsMake(sfb, focus = 's27', layer = c(0, 2)) 
plot(y, main = 'Station 27')

y <- tsMake(sfb, focus = 'chl', layer = list(c(0, 2), 5))
plot(y, main = 'Chlorophyll a, ug/L')

y <- tsMake(sfb, focus = 'chl', layer = c(0, 5), type = 'zoo')
head(y)
plot(y, main = 'Chlorophyll a, ug/L')

Run the code above in your browser using DataLab