Skip to contents

Interconverts dates in a variety of calendars.

Usage

convert(from, to, ...)

# S4 method for class 'character,character'
convert(from, to)

# S4 method for class 'TimeScale,TimeScale'
convert(from, to)

Arguments

from

A TimeScale object describing the source calendar.

to

A TimeScale object describing the target calendar.

...

Currently not used.

Value

A function that when called with a single numeric argument (factional years) converts years from one calendar to another.

See also

Other calendar tools: calendar(), calendar_get, gregorian, is(), julian()

Author

N. Frerebeau

Examples

## Define time scales
BP <- calendar("BP")
AD <- calendar("AD")

## Make conversion functions
BP_to_AD <- convert(BP, AD)
AD_to_BP <- convert(AD, BP)

## Convert years
BP_to_AD(0)
#> [1] 1950
AD_to_BP(1950)
#> [1] 0