[R-sig-Epi] Converting dates from the Persian calendar to Gregorian

BXC (Bendix Carstensen) bxc at steno.dk
Wed Jan 7 14:00:57 CET 2009


I already sent this request off to inquire with Peter Dalgard and Martyn Plummer from the R-core team, and got this back from Peter:
 
> -----Original Message-----
> From: Peter Dalgaard [mailto:P.Dalgaard at biostat.ku.dk] 
> Sent: 7. januar 2009 13:43
> To: BXC (Bendix Carstensen)
> Cc: pd at biostat.ku.dk; Martyn Plummer
> Subject: Re: FW: [R-sig-Epi] Converting dates from the 
> Persian calendar to Gregorian
> 
> Also notice that M-x calendar in Emacs does a lot of this stuff.
> 
> 
> p o		calendar-print-other-dates
> p m		calendar-print-mayan-date
> p f		calendar-print-french-date
> p i		calendar-print-islamic-date
> p h		calendar-print-hebrew-date
> p a		calendar-print-astro-day-number
> p j		calendar-print-julian-date
> p c		calendar-print-iso-date
> p p		calendar-print-persian-date
> p e		calendar-print-ethiopic-date
> p k		calendar-print-coptic-date
> p C		calendar-print-chinese-date
> p d		calendar-print-day-of-year
> 

Yes it might be a good idea to pose this to the R-devel list as a facility that should be included in R --- presumably with the same facilities as in emacs.

Best regards,
Bendix 

> -----Original Message-----
> From: Amy Mikhail [mailto:amy.mikhail at googlemail.com] 
> Sent: 7. januar 2009 13:45
> To: BXC (Bendix Carstensen)
> Cc: r-sig-epi at stat.math.ethz.ch
> Subject: Re: [R-sig-Epi] Converting dates from the Persian 
> calendar to Gregorian
> 
> Hi Bendix,
> 
> Many thanks - yes, I had already visited Homam's page.  I 
> have posted a message there asking if there is some way to 
> link his code / function to my MS Access database, but having 
> this as a function in R would be better.
> 
> Any takers, who know both C and R?  Should I also post this 
> to the R devel list?
> 
> Best wishes,
> Amy
> 
> 
> 
> On Wed, Jan 7, 2009 at 12:26 PM, BXC (Bendix Carstensen) 
> <bxc at steno.dk> wrote:
> 
> 
> 	Hi Amy,
> 	you probaly already have visited:
> 	http://www.codeproject.com/KB/cs/JalaliCalendar.aspx
> 	where the Iranian guy Homam Hosseini provides a 
> discussion of the conversion, and some C code to do it.
> 	
> 	I am a C ignorant, but surely someone in the 
> R-community would be able to take this code (and in 
> collaboration with Homam) provide a function that converts 
> Iranian / Jalali dataes to and from the Gregorian Date class??
> 	
> 	Best regards
> 	Bendix
> 	
> 
> 	> -----Original Message-----
> 	> From: r-sig-epi-bounces at stat.math.ethz.ch
> 	> [mailto:r-sig-epi-bounces at stat.math.ethz.ch] On 
> Behalf Of Amy Mikhail
> 	> Sent: 7. januar 2009 12:40
> 	> To: r-sig-epi at stat.math.ethz.ch
> 	> Subject: [R-sig-Epi] Converting dates from the Persian
> 	> calendar to Gregorian
> 	>
> 	> Dear Epi list,
> 	>
> 	> This is not a strictly epidemiological question, but an issue
> 	> that anyone might face if presented with a dataset containing
> 	> dates in a non-gregorian format.
> 	>
> 	> I am currently developing a database (in MS Access) for a
> 	> public health study, the results of which I intend to analyse
> 	> in R.  I have a small problem, in that the date each patient
> 	> visits the clinic will be entered into the database in the
> 	> Persian  / Jalali calendar format - e.g. today's
> 	> date in the Persian calendar is 18.10.1387.   For the
> 	> analysis however I
> 	> need these dates to be converted to Gregorian, so that I can
> 	> have months on the x axis of plots, etc.
> 	>
> 	> Does anyone know of a function / some code already written
> 	> that could do this conversion in R?  It is much too complex
> 	> for me to figure out (since the Persian new year starts on
> 	> 21st March, and although there are also 12 months they have
> 	> different lengths to gregorian months).  I'm guessing it
> 	> would require loops and such but this is beyond my current
> 	> level of R knowledge.
> 	>
> 	> I have found some online tools that do the conversion of
> 	> individual dates, but there seems to be nothing out there
> 	> that would convert a whole dataset's worth of dates.
> 	>
> 	> Any suggestions much appreciated,
> 	> With best wishes,
> 	> Amy
> 	>
> 	>
> 	> --
> 	> Amy Mikhail
> 	> Program Manager, ACTc Afghanistan Malaria Project London
> 	> School of Hygiene & Tropical Medicine HPRO, Charahi-e-Shahid,
> 	> Shar-e-Naw, Kabul, Afghanistan
> 	>
> 	> Email (Afg): amy.mikhail at googlemail.com
> 	> Email (UK): Amy.Mikhail at lshtm.ac.uk
> 	> Tel (Afg): +93 (0)706 126627
> 	> Tel (UK): +44 (0)781 4176107
> 	>
> 	
> 	>       [[alternative HTML version deleted]]
> 	>
> 	> _______________________________________________
> 	> R-sig-Epi at stat.math.ethz.ch mailing list
> 	> https://stat.ethz.ch/mailman/listinfo/r-sig-epi
> 	> 
> 
> 
> 
> 
> --
> Amy Mikhail
> Program Manager, ACTc Afghanistan Malaria Project London 
> School of Hygiene & Tropical Medicine HPRO, Charahi-e-Shahid, 
> Shar-e-Naw, Kabul, Afghanistan
> 
> Email (Afg): amy.mikhail at googlemail.com
> Email (UK): Amy.Mikhail at lshtm.ac.uk
> Tel (Afg): +93 (0)706 126627
> Tel (UK): +44 (0)781 4176107
> 
> 


More information about the R-sig-Epi mailing list