Learn R Programming

era

era is an R package that provides a consistent representation of year-based time scales as a numeric vector with an associated era – the yr class.

It includes built-in era definitions for many year numbering systems used in contemporary and historic calendars (e.g. Common Era, Islamic ‘Hijri’ years); year-based time scales used in archaeology, astronomy, geology, and other palaeosciences (e.g. Before Present, SI-prefixed annus); and support for arbitrary user-defined eras. Years can converted from any one era to another using the generalised transformation function yr_transform().

era’s classes are based on vctrs, and come with methods for robust casting and coercion between years and other numeric types, type-stable arithmetic with years, and pretty-printing in tables.

Installation

You can install the released version of era from CRAN with:

install.packages("era")

Or the development version from GitHub using the remotes package:

# install.packages("remotes")
remotes::install_github("joeroe/era")

Basic usage

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

library(era)
x <- yr(c(9000, 8000, 7000), "cal BP")
x
#> # 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] 7051 6051 5051
#> # Era: Before Common Era (BCE): Gregorian years (365.2425 days), counted backwards from 1

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")).

Copy Link

Version

Install

install.packages('era')

Monthly Downloads

380

Version

0.6.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Joe Roe

Last Published

July 30th, 2026

Functions in era (0.6.0)

yr_sort

Chronological ordering of year vectors
yr_transform

Convert years from one era to another
era_year_parameters

Get the parameters of an era_year object.
is_era

Validation functions for era objects
era-rlang

Internal rlang methods
eras

Standard era definitions
era_parameters

Get parameters of an era
is_yr

Validation functions for yr objects
era_year

Year units
is_era_year

Validation functions for era_year objects
era

Create an era object
yr_earlier_than

Chronological comparison of years
yr

Create a vector of years with era
this_year

Current year
yr_extremes

Chronological minima and maxima
yr_era

Get or set the era of a vector of years
yr_difference

Chronological difference between year vectors
era-vctrs

Internal vctrs methods