mts_select {MazamaTimeSeries}R Documentation

Reorder and subset time series within an mts time series object

Description

This function acts similarly to dplyr::select() working on mts$data. The returned mts object will contain only those time series identified by deviceDeploymentID in the order specified.

This can be used the specify a preferred order and is helpful when using faceted plot functions based on ggplot such as those found in the AirMonitorPlots package.

Usage

mts_select(mts = NULL, deviceDeploymentID = NULL)

Arguments

mts

mts object.

deviceDeploymentID

Vector of timeseries unique identifiers.

Value

A reordered (subset) of the incoming mts time series object. (A list with meta and data dataframes.)

See Also

mts_selectWhere

Examples

library(MazamaTimeSeries)

# Filter for "El Monte"
El_Monte <-
  example_mts %>%
  mts_filterMeta(communityRegion == "El Monte")

ids <- El_Monte$meta$deviceDeploymentID
rev_ids <- rev(ids)

print(ids)
print(rev_ids)

rev_El_Monte <-
  example_mts %>%
  mts_select(rev_ids)

print(rev_El_Monte$meta$deviceDeploymentID)


[Package MazamaTimeSeries version 0.3.0 Index]