Create a combined mts_monitor from any number of mts_monitor
objects or from a list of mts_monitor objects. The resulting mts_monitor
object with contain all deviceDeploymentIDs
found in any incoming
mts_monitor and will have a regular time axis covering the the entire range
of incoming data.
If incoming time ranges are tempporally non-contiguous, the resulting
mts_monitor will have gaps filled with NA
values.
An error is generated if the incoming mts_monitor objects have
non-identical metadata for the same deviceDeploymentID
unless
replaceMeta = TRUE
.
monitor_combine(
...,
replaceMeta = FALSE,
overlapStrategy = c("replace all", "replace na")
)
Any number of valid mts_monitor objects or a list of objects.
Logical specifying whether to allow replacement of metadata
associated when duplicate deviceDeploymentIDs
are encountered.
Strategy to use when data found in time series overlaps.
A combined mts_monitor
object. (A list with
meta
and data
dataframes.)
Data are combined with a "later is better" sensibility where any data overlaps exist. Incoming mts_monitor objects are ordered based on the time stamp of their last record. Any data records found in a "later" mts_monitor will overwrite data associated with an "earlier" mts_monitor.
With overlapStrategy = "replace all"
, any data records found
in "later" mts_monitor objects are preferentially retained before the "shared"
data are finally reordered by ascending datetime
.
With overlapStrategy = "replace missing"
, only missing values in "earlier"
mts_monitor objects are replaced with data records from "later" time series.
library(AirMonitor)
# Two monitors near Pendelton, Oregon
#
# Use the interactive map to get the deviceDeploymentIDs
# NW_Megafires %>% monitor_leaflet()
Pendleton_West <-
NW_Megafires %>%
monitor_select("f187226671d1109a_410590121_03") %>%
monitor_filterDatetime(2015082300, 2015082305)
Pendleton_East <-
NW_Megafires %>%
monitor_select("6c906c6d1cf46b53_410597002_02") %>%
monitor_filterDatetime(2015082300, 2015082305)
monitor_combine(Pendleton_West, Pendleton_East) %>%
monitor_getData()
#> datetime f187226671d1109a_410590121_03
#> 1 2015-08-23 07:00:00 67.1
#> 2 2015-08-23 08:00:00 66.6
#> 3 2015-08-23 09:00:00 65.6
#> 4 2015-08-23 10:00:00 63.9
#> 5 2015-08-23 11:00:00 62.0
#> 6c906c6d1cf46b53_410597002_02
#> 1 62.7
#> 2 56.9
#> 3 52.8
#> 4 55.9
#> 5 55.2