era 0.6.0: chronological comparison and difference

[This article was first published on Joe Roe, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

era v0.6.0 is now available on CRAN:

install.packages("era")
library(era)

This minor release adds functions for chronological comparison of year vectors:

x <- yr(c(200, 100, 300), "BCE")
yr_earlier_than(x, yr(150, "BCE"))
#> # BCE years <yr_lgl[3]>:
#> [1] FALSE FALSE  TRUE
#> # Era: Before Common Era (BCE): Gregorian years (365.2425 days), counted backwards from 1

yr_later_than(x, yr(150, "BCE"))
#> # BCE years <yr_lgl[3]>:
#> [1]  TRUE FALSE FALSE
#> # Era: Before Common Era (BCE): Gregorian years (365.2425 days), counted backwards from 1

And for calculating chronological differences between year vectors:

yr_difference(yr(300, "BCE"), yr(100, "BCE"))
#> # years <yr[1]>:
#> [1] 200
#> # Era: Gregorian years (365.2425 days)

These functions are aware of era directionality: “BCE” years count backwards, so 300 BCE is earlier than 100 BCE. They support work on tempo, a new package I am working on that represents chronological intervals and the temporal relations between them.

To leave a comment for the author, please follow the link and comment on their blog: Joe Roe.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)