Skip to content
Prev 162 / 584 Next

Converting dates from the Persian calendar to Gregorian

I looked at the C code from Project Pluto that Hosseini references, and wrote R wrappers for it.  The C and R code are at
  http://faculty.washington.edu/tlumley/calendars

I haven't turned it into a package (anyone who wants to is welcome), and it has only been tested to a limited extent and only on Mac OS.

Build the C code with
   R CMD SHLIB convdates.c date.cpp
then source("convdates.R")

This sets up an OtherDate class that can hold Persian, Islamic, Hebrew, and the other calendars that the C code supports, with methods to convert to and from Date.

It should be possible to translate the C algorithms into straight R with little loss of efficiency, but that looked like more than an hour's work.

       -thomas
On Wed, 7 Jan 2009, BXC (Bendix Carstensen) wrote:

            
Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle