Time Series Subset
Filter rows and/or select columns of a DTSg
object.
## S3 method for class 'DTSg' subset( x, i, cols = self$cols(), funby = NULL, ignoreDST = FALSE, na.status = "implicit", clone = getOption("DTSgClone"), multiplier = 1L, funbyHelpers = NULL, ... )
x |
A |
i |
An integerish vector indexing rows (positive numbers pick and
negative numbers omit rows) or a filter expression accepted by the |
cols |
A character vector specifying the columns to select. The .dateTime column is always selected and cannot be part of it. |
funby |
One of the temporal aggregation level functions described in
|
ignoreDST |
A logical specifying if day saving time is ignored during
formation of the temporal level. See |
na.status |
A character string. Either |
clone |
A logical specifying if the object is modified in place or if a clone (copy) is made beforehand. |
multiplier |
A positive integerish value “multiplying” the
temporal aggregation level of certain |
funbyHelpers |
An optional |
... |
Not used (S3 method only). |
Please note that filtering rows and having or making missing timestamps
explicit equals to setting the values of all other timestamps to missing.
The default value of na.status
is therefore "implicit"
. To
simply filter for a consecutive range of a DTSg
object while
leaving na.status
untouched, alter
is probably the
better choice.
Returns a DTSg
object.
# new DTSg object x <- DTSg$new(values = flow) # filter for the first six rows ## R6 method x$subset(i = 1:6) ## S3 method subset(x = x, i = 1:6) # filter for the last two observations per year ## R6 method x$subset(i = (.N - 1):.N, funby = function(x, ...) {data.table::year(x)}) ## S3 method subset(x = x, i = (.N - 1):.N, funby = function(x, ...) {data.table::year(x)})
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.