Learn R Programming

unstruwwel (version 0.2.2)

Periods: Set a Period and Get its Time Interval

Description

Set a Period and Get its Time Interval

Set a Period and Get its Time Interval

Arguments

Public fields

.interval

Stores a time interval.

fuzzy

Either `-1` (approximate) or `1` (uncertain).

express

Either `-1` (before) or `1` (after).

Active bindings

.interval

Stores a time interval.

interval

Convert and return a POSIXt time interval.

time_span

Convert and return a time span in years.

iso_format

Convert and return a date in ISO 8601.

Methods


Method new()

Helper function to specify a time period.

Create a time period.

Usage

Periods$new(...)

Arguments

...

Intervals, numerical scalars, or objects of class Period.

x

A numerical scalar. The range of valid values depends on type. If type is "early", "mid", or "late", x is ignored.

type

A character scalar. The following values are supported: "early", "mid", "late", "quarter", "third", and "half". If type is `NULL`, x defines a year or decade.


Method set_additions()

Set additions for a time period.

Usage

Periods$set_additions(x)

Arguments

x

A character vector.


Method take()

Specify a period.

Usage

Periods$take(x = NA, type = NA, ignore_errors = FALSE)

Arguments

x

A numerical scalar. The range of valid values depends on type. If type is "early", "mid", or "late", x is ignored.

type

A character scalar. The following values are supported: "early", "mid", "late", "quarter", "third", and "half". If type is `NULL`, x defines a year or decade.

ignore_errors

If `TRUE`, error messages are ignored.

Returns

Object of R6Class with methods to set common time periods and specifications for time periods.


Method clone()

The objects of this class are cloneable with this method.

Usage

Periods$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Details

An Object of R6Class with methods to set common time periods and specifications for time periods.