lead.lag: Shift an Fts ojbect in time

Description Usage Arguments Details Value Author(s) Examples

Description

Shift an Fts ojbect forward or backwards in time be the supplied number of periods

Usage

1
2
3
4
## S3 method for class 'fts'
lead(x, k, ...)
## S3 method for class 'fts'
lag(x, k, ...)

Arguments

x

An Fts object

k

number of periods to shift

...

further arguments to function

Details

removed elements are replaced with NA

Value

an Fts object

Author(s)

Whit Armstrong

Examples

1
2
3
4
x <- fts(index=seq(from=Sys.Date(),by="days",length.out=10),data=1:10)
print(x)
lag(x,1)
lead(x,1)

Example output

Loading required package: zoo

Attaching package:zooThe following objects are masked frompackage:base:

    as.Date, as.Date.numeric

           [,1]
2021-05-24    1
2021-05-25    2
2021-05-26    3
2021-05-27    4
2021-05-28    5
2021-05-29    6
2021-05-30    7
2021-05-31    8
2021-06-01    9
2021-06-02   10
           [,1]
2021-05-25    1
2021-05-26    2
2021-05-27    3
2021-05-28    4
2021-05-29    5
2021-05-30    6
2021-05-31    7
2021-06-01    8
2021-06-02    9
           [,1]
2021-05-24    2
2021-05-25    3
2021-05-26    4
2021-05-27    5
2021-05-28    6
2021-05-29    7
2021-05-30    8
2021-05-31    9
2021-06-01   10

fts documentation built on May 2, 2019, 9:17 a.m.

Related to lead.lag in fts...