seq.ymon: Sequence generation

Description Usage Arguments Examples

View source: R/ymon-seq.R

Description

This seq() method generates regular sequences of ymon objects. It functions the same as the default seq() method, except that fractional sequences that might be generated by seq(to =, length.out =) are not allowed.

seq() methods require a from argument, and any combination of two of the other arguments. The only combination not allowed is length.out and along.with, because they represent the same information.

Usage

1
2
## S3 method for class 'ymon'
seq(from, to, by, length.out, along.with, ...)

Arguments

from

[ymon]

A ymon.

to

[ymon]

Optional. A ymon.

by

[integer(1)]

Optional. A single integer representing the step size. Must be negative if to is supplied and the sequence between from and to is decreasing.

length.out

[integer(1)]

Optional. A single integer representing the final output size. If to is supplied, this must divide the distance between from and to into equally spaced pieces, otherwise an error is thrown.

along.with

[vector]

Optional. A vector to take the length of. The length of the vector is used as the length.out value.

...

Not used.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
x <- ymon(1970, 1)

seq(x, by = 3, length.out = 10)

seq(x, to = ymon(1980, 1), by = 6)

seq(x, to = ymon(1980, 1), length.out = 5)

# 4 values between 1970-01 and 1970-04, there
# is no way to divide these evenly into 3 equally spaced pieces!
try(seq(x, to = ymon(1970, 4), length.out = 3))

DavisVaughan/datea documentation built on April 10, 2020, 12:03 a.m.