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.

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

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)
#> [1] "36fa039140645de8_2504" "173ff64a55da1183_2693" "055497925c615bbd_2452"
#> [4] "6db0b260ed58bea0_2713" "8d9ad84c05e66fcb_2496"
print(rev_ids)
#> [1] "8d9ad84c05e66fcb_2496" "6db0b260ed58bea0_2713" "055497925c615bbd_2452"
#> [4] "173ff64a55da1183_2693" "36fa039140645de8_2504"

rev_El_Monte <-
  example_mts %>%
  mts_select(rev_ids)

print(rev_El_Monte$meta$deviceDeploymentID)
#> [1] "8d9ad84c05e66fcb_2496" "6db0b260ed58bea0_2713" "055497925c615bbd_2452"
#> [4] "173ff64a55da1183_2693" "36fa039140645de8_2504"