new_rbundle {almanac}R Documentation

Constructor for an rbundle

Description

new_rbundle() is a developer focused tool that is not required for normal usage of almanac. It constructs a new rbundle directly from a list of existing rschedules.

rbundle_restore() is a generic function that rbundle subclasses can provide a method for. It dispatches off of to. Its sole purpose is to restore classes and fields of the subclass after calling any of the following functions:

Usage

new_rbundle(
  rschedules = list(),
  rdates = new_date(),
  exdates = new_date(),
  ...,
  class = character()
)

rbundle_restore(x, to)

Arguments

rschedules

[list]

A list of rschedules.

rdates

[Date]

A vector of dates to forcibly include in the event set.

exdates

[Date]

A vector of dates to forcibly exclude from the event set.

...

[named dots]

Additional named elements added to the rbundle object.

class

[character]

An optional subclass.

x

[rbundle]

An updated rbundle that needs to be restored to the type of to.

to

[rbundle subclass]

An rbundle subclass that you are restoring to.

Details

An rbundle is an abstract class that rintersect, runion, and rsetdiff all inherit from. The sole purpose of an rbundle subclass is to implement an rbundle_restore() method that defines how to recover the original rbundle subclass after adding a new rschedule, rdate, or exdate. Additionally, because rbundles are also rschedules, a rschedule_events() method must be implemented.

Value

Examples

new_rbundle()

x <- daily()
y <- weekly()

rschedules <- list(x, y)

new_rbundle(rschedules)

[Package almanac version 0.1.1 Index]