Trims the date range of a sts object to local time date boundaries which are within the range of data. This has the effect of removing partial-day data records at the start and end of the timeseries and is useful when calculating full-day statistics.
Day boundaries are calculated using the specified timezone
or, if
NULL
, from sts$meta$timezone
.
sts_trimDate(sts = NULL, timezone = NULL)
sts | SingleTimeSeries sts object. |
---|---|
timezone | Olson timezone used to interpret dates. |
A subset of the incoming sts time series object.
(A list with meta
and data
dataframes.)
library(MazamaTimeSeries) UTC_week <- sts_filterDate( example_sts, startdate = 20180808, enddate = 20180815, timezone = "UTC" ) # UTC day boundaries head(UTC_week$data)#> # A tibble: 6 × 19 #> datetime pm25_A pm25_B temperature humidity pressure pm1_atm_A #> <dttm> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 2018-08-08 00:00:00 4.55 4.86 87 29 NA 3.07 #> 2 2018-08-08 00:01:00 4.49 4.43 87 29 NA 3.51 #> 3 2018-08-08 00:02:00 4.38 NA 87 29 NA 3.43 #> 4 2018-08-08 00:03:00 NA 3.93 NA NA NA NA #> 5 2018-08-08 00:04:00 4.31 4.66 86 29 NA 3.31 #> 6 2018-08-08 00:05:00 4.86 3.29 86 29 NA 3.86 #> # … with 12 more variables: pm25_atm_A <dbl>, pm10_atm_A <dbl>, #> # pm1_atm_B <dbl>, pm25_atm_B <dbl>, pm10_atm_B <dbl>, uptime <dbl>, #> # rssi <dbl>, memory <dbl>, adc0 <dbl>, bsec_iaq <dbl>, datetime_A <dttm>, #> # datetime_B <dttm>#> # A tibble: 6 × 19 #> datetime pm25_A pm25_B temperature humidity pressure pm1_atm_A #> <dttm> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 2018-08-08 07:00:00 10.2 9 78 41 NA 7.44 #> 2 2018-08-08 07:01:00 9.74 9.21 78 41 NA 7.93 #> 3 2018-08-08 07:02:00 9.56 NA 78 41 NA 7.33 #> 4 2018-08-08 07:03:00 NA 9.14 NA NA NA NA #> 5 2018-08-08 07:04:00 9.44 8.55 78 41 NA 7.8 #> 6 2018-08-08 07:05:00 10 9.66 78 41 NA 7.79 #> # … with 12 more variables: pm25_atm_A <dbl>, pm10_atm_A <dbl>, #> # pm1_atm_B <dbl>, pm25_atm_B <dbl>, pm10_atm_B <dbl>, uptime <dbl>, #> # rssi <dbl>, memory <dbl>, adc0 <dbl>, bsec_iaq <dbl>, datetime_A <dttm>, #> # datetime_B <dttm>