seq.jdate {shide}R Documentation

Generate regular sequences of Jalali dates

Description

The method for seq for objects of class jdate.

Usage

## S3 method for class 'jdate'
seq(from, to, by, length.out = NULL, along.with = NULL, ...)

Arguments

from

starting date. Required.

to

end date. Optional.

by

increment of the sequence. Optional. See ‘Details’.

length.out

integer, optional. Desired length of the sequence.

along.with

take the length from the length of this argument.

...

arguments passed to or from other methods.

Details

by can be specified in several ways:

Value

A vector of jdate objects.

Comparison with seq.Date()

The source code of seq.jdate() is a modified version of the code used in base::seq.Date(). But a few behaviors of the latter are changed:

These differences are illustrated in the examples.

See Also

base::seq.Date()

Examples

# by days
seq(jdate("1402-01-01"), jdate("1402-01-10"), 1)
# by 2 weeks
seq(jdate("1402-01-01"), jdate("1402-04-01"), "2 weeks")
# first days of years
seq(jdate("1390-01-01"), jdate("1399-01-01"), "years")
# by month
seq(jdate("1400-01-01"), by = "month", length.out = 12)
# quarters
seq(jdate("1400-01-01"), jdate("1403-01-01"), by = "quarter")

# fractional dates are allowed in `seq.Date()`, but not in `seq.jdate()`
unclass(seq(as.Date(0), as.Date(3), length.out = 3))
unclass(seq(jdate(0), jdate(2), length.out = 3))

# resloving strategy for invalid dates is different in 'seq.jdate()' compared to 'seq.Date()'
seq(as.Date("2021-01-31"), by = "months", length.out = 2)
seq(jdate("1402-06-31"), by = "6 months", length.out = 2)

[Package shide version 0.2.1 Index]