format: Date Conversion to Character

formatR Documentation

Date Conversion to Character

Description

Date Conversion to Character

Usage

## S4 method for signature 'TimeScale'
format(x)

## S4 method for signature 'RataDie'
format(
  x,
  prefix = c("a", "ka", "Ma", "Ga"),
  label = TRUE,
  calendar = getOption("aion.calendar")
)

Arguments

x

A RataDie object.

prefix

A character string specifying the prefix. It should be one of "a", "ka", "Ma" or "Ga". If TRUE, a good guess for an appropriate format is made.

label

A logical scalar: should the label of the calendar be displayed?

calendar

A TimeScale object specifying the target calendar (see calendar()).

Value

A character vector representing the date.

Author(s)

N. Frerebeau

See Also

Other fixed date tools: arithmetic, as_date(), as_decimal(), as_fixed(), as_year(), fixed(), fixed_gregorian, fixed_julian, pretty()

Examples

## R 1.0.0
(y <- fixed(year = 2000, month = 02, day = 29, calendar = CE()))
as_date(y, calendar = CE())
as_year(y, calendar = CE())

## Create a vector of years BP (Gregorian)
## (every two years starting from 2000 BP)
(years <- seq(from = 2000, by = -2, length.out = 10))
## Convert years to rata die
(rd <- fixed(years, calendar = BP()))
## Convert back to Gregorian years BP
as_year(rd, calendar = BP())

## More convenient
(rd <- fixed_from_BP(years))
fixed_to_BP(rd)

aion documentation built on Oct. 4, 2024, 5:07 p.m.