update.lts | R Documentation |
Update the attributes of lts
, gts
and imu
object
## S3 method for class 'lts'
update(object, type, new, keep.start = T, ...)
## S3 method for class 'gts'
update(object, type, new, keep.start = T, ...)
## S3 method for class 'imu'
update(object, type, new, ...)
object |
A |
type |
A |
new |
The updated value for the attribute |
keep.start |
A |
... |
Further arguments passed to or from other methods. |
This function is able to update some attributes for gts
, lts
and imu
objects.
For lts
object, the attributes that can be updated are 'start', 'end', 'freq', 'unit_time', 'name_ts' and 'process'.
For gts
object, the attributes that can be updated are 'start', 'end', 'freq', 'unit_time' and 'name_ts'.
For imu
object, the attributes that can be updated are 'axis', 'freq', 'unit_time' and 'name_ts'.
If one between 'start' and 'end' is updated, the other one will also be updated, since end-start == (N-1)/freq
must be TRUE, where N
is the number of observations in the object.
If 'freq' is updated, by default 'start' will remain the same, and 'end' will be updated at the same time, unless you set 'keep.start = F'.
If 'unit_time' is updated, the old unit_time will be replaced by the new one, and other attributes will remain the same. It is different from the unit_time conversion feature.
An object with the updated attribute.
gts1 = gts(rnorm(50), freq = 1, unit_time = 'sec', name_ts = 'test1')
gts2 = update(gts1, 'unit_time', 'min')
attr(gts2, 'unit_time')
gts3 = update(gts1, 'name_ts', 'test2')
attr(gts3, 'name_ts')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.