Project Status: Active – The project has reached a stable, usable state and is being actively developed. R build status Codecov test coverage

era is an R package that provides a consistent vector representation of years with an associated calendar era or time scale. It includes built-in definitions of many contemporary and historic calendars; time scales commonly used in archaeology, astronomy, geology, and other palaeosciences (e.g. Before Present, SI-prefixed annus); and support for arbitrary user-defined eras. Functions for converting between eras and for type-stable arithmetic with years are also provided.


You can install the development version of era from GitHub with the remotes package.

# install.packages("remotes")

Basic usage

yr() defines the era associated with a vector of years:

x <- yr(c(9000, 8000, 7000), "cal BP")
#> # cal BP years <yr[3]>:
#> [1] 9000 8000 7000
#> # Era: Before Present (cal BP): Gregorian years (365.2425 days), counted backwards from 1950

Use yr_transform() to convert between eras:

yr_transform(x, "BCE")
#> # BCE years <yr[3]>:
#> [1] 7050 6050 5050
#> # Era: Before Common Era (BCE): Gregorian years (365.2425 days), counted backwards from 0

Many common calendar systems and time scales are predefined (see ?eras()) and can be referenced by their abbreviated labels. Other eras can be defined using the era() function directly.

For further usage, see the package introduction (vignette("era")).