| TALFs {DTSg} | R Documentation |
Temporal Aggregation Level Functions (TALFs)
Description
Simply hand over one of these functions to the funby argument of one of the
methods of a DTSg object, which supports it. The method then does the
rest of the work. See respective calling method for further information.
Other uses are possible, but not recommended.
Usage
byY_____(.dateTime, .helpers)
byYQ____(.dateTime, .helpers)
byYm____(.dateTime, .helpers)
byYmd___(.dateTime, .helpers)
byYmdH__(.dateTime, .helpers)
byYmdHM_(.dateTime, .helpers)
byYmdHMS(.dateTime, .helpers)
by______(.dateTime, .helpers)
by_Q____(.dateTime, .helpers)
by_m____(.dateTime, .helpers)
by___H__(.dateTime, .helpers)
by____M_(.dateTime, .helpers)
by_____S(.dateTime, .helpers)
byFasttimeY_____(.dateTime, .helpers)
byFasttimeYQ____(.dateTime, .helpers)
byFasttimeYm____(.dateTime, .helpers)
byFasttimeYmd___(.dateTime, .helpers)
byFasttimeYmdH__(.dateTime, .helpers)
byFasttimeYmdHM_(.dateTime, .helpers)
byFasttimeYmdHMS(.dateTime, .helpers)
byFasttime______(.dateTime, .helpers)
byFasttime_Q____(.dateTime, .helpers)
byFasttime_m____(.dateTime, .helpers)
byFasttime___H__(.dateTime, .helpers)
byFasttime____M_(.dateTime, .helpers)
byFasttime_____S(.dateTime, .helpers)
Arguments
.dateTime |
A |
.helpers |
A |
Value
All functions return a POSIXct vector with timestamps
corresponding to the function's temporal aggregation level.
Families and flavours
There are two families of temporal aggregation level functions. The one
family truncates timestamps (truncating family), the other extracts a certain
part of them (extracting family). Each family comes in three flavours: the
first relies solely on base R, the second utilises fasttime::fastPOSIXct
of fasttime and the third RcppCCTZ::parseDatetime of
RcppCCTZ.
The fasttime flavour works with UTC and equivalent as well as all
Etc/GMT time zones only (execute
grep("^(Etc/)?(UCT|UTC)$|^(Etc/)?GMT(\\+|-)?0?$", OlsonNames(), ignore.case = TRUE, value = TRUE) for a full list of supported time zones) and is
limited to timestamps between the years 1970 and 2199, but generally is the
fastest for the extracting family of functions. For time zones other than UTC
and equivalent the RcppCCTZ flavour generally is the fastest.
Use the funbyApproach argument of the respective calling method in order to
specify the utilised flavour.
The truncating family sets timestamps to the lowest possible point in time of the corresponding temporal aggregation level:
-
byY_____truncates to year, e.g. 2000-11-11 11:11:11.1 becomes 2000-01-01 00:00:00.0 -
byYQ____truncates to quarter, e.g. 2000-11-11 11:11:11.1 becomes 2000-10-01 00:00:00.0 -
byYm____truncates to month, e.g. 2000-11-11 11:11:11.1 becomes 2000-11-01 00:00:00.0 -
byYmd___truncates to day, e.g. 2000-11-11 11:11:11.1 becomes 2000-11-11 00:00:00.0 -
byYmdH__truncates to hour, e.g. 2000-11-11 11:11:11.1 becomes 2000-11-11 11:00:00.0 -
byYmdHM_truncates to minute, e.g. 2000-11-11 11:11:11.1 becomes 2000-11-11 11:11:00.0 -
byYmdHMStruncates to second, e.g. 2000-11-11 11:11:11.1 becomes 2000-11-11 11:11:11.0
By convention, the extracting family sets the year to 2199 and extracts a certain part of timestamps:
-
by______extracts nothing, i.e. all timestamps become 2199-01-01 00:00:00.0 -
by_Q____extracts the quarters, e.g. 2000-11-11 11:11:11.1 becomes 2199-10-01 00:00:00.0 -
by_m____extracts the months, e.g. 2000-11-11 11:11:11.1 becomes 2199-11-01 00:00:00.0 -
by___H__extracts the hours, e.g. 2000-11-11 11:11:11.1 becomes 2199-01-01 11:00:00.0 -
by____M_extracts the minutes, e.g. 2000-11-11 11:11:11.1 becomes 2199-01-01 00:11:00.0 -
by_____Sextracts the seconds, e.g. 2000-11-11 11:11:11.1 becomes 2199-01-01 00:00:11.0
Please note that the byFasttime* versions are deprecated.