alter.DTSg | R Documentation |
Shortens, lengthens, filters for a consecutive range, changes the periodicity
and/or the status of missing values of a DTSg
object.
## S3 method for class 'DTSg'
alter(
x,
from = first(self$values(reference = TRUE)[[".dateTime"]]),
to = last(self$values(reference = TRUE)[[".dateTime"]]),
by = self$periodicity,
rollback = TRUE,
clone = getOption("DTSgClone"),
na.status = self$na.status,
...
)
x |
A |
from |
A |
to |
A |
by |
Specifies the new periodicity in one of the ways the |
rollback |
A logical specifying if a call to |
clone |
A logical specifying if the object shall be modified in place or if a deep clone (copy) shall be made beforehand. |
na.status |
A character string. Either |
... |
Not used (S3 method only). |
Returns a DTSg
object.
getOption
, subset
, nas
# new DTSg object
x <- DTSg$new(values = flow)
# filter for the first two years
## R6 method
x$alter(
from = "2007-01-01",
to = "2008-12-31"
)$print()
## S3 method
print(alter(
x = x,
from = "2007-01-01",
to = "2008-12-31"
))
# change periodicity to one month
## R6 method
x$alter(by = "1 month")$print()
## S3 method
print(alter(x = x, by = "1 month"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.