[R] How to convert month-day-year to Julian data number?

arun smartpink111 at yahoo.com
Fri Jun 15 14:30:10 CEST 2012


Hi,

Try:
?library(chron)
julian()

 x<-c(1:5) #month
 d<-c(10:14) #day
 y<-1970 #year



julian(x,d,y,origin=c(month=2,day=1,year=1970))


[1] -22  10  39  71 102


A.K.

----- Original Message -----
From: Paloma Moya <polillaplm at yahoo.es>
To: "r-help at r-project.org" <r-help at r-project.org>
Cc: 
Sent: Friday, June 15, 2012 2:13 AM
Subject: [R] How to convert month-day-year to Julian data number?

Hello,
I am trying to convert calendar dates (Month, Day, Year) into Julian Days

Product code Bureau of Meteorology station number Month Day Year Date_mdy Date 
4102001 70014 1 1 1939 1/01/1939 1/01/1939 
4102001 70014 1 2 1939 1/02/1939 2/01/1939 
4102001 70014 1 3 1939 1/03/1939 3/01/1939 
4102001 70014 1 4 1939 1/04/1939 4/01/1939 
4102001 70014 1 5 1939 1/05/1939 5/01/1939 
4102001 70014 1 6 1939 1/06/1939 6/01/1939 
4102001 70014 1 7 1939 1/07/1939 7/01/1939 

These are the type of data that I have


I am trying to get the output as

Product code Bureau of Meteorology station number Month Day Year Date_mdy Date JD 
4102001 70014 1 1 1939 ######## ######## 215421 
4102001 70014 1 2 1939 ######## ######## 215422 
4102001 70014 1 3 1939 ######## ######## 215423 
4102001 70014 1 4 1939 ######## ######## 215424 
4102001 70014 1 5 1939 ######## ######## 215425 
4102001 70014 1 6 1939 ######## ######## 215426 
4102001 70014 1 7 1939 ######## ######## 215427 

(these JDs are fictions) 

I have tried to apply strftime, mdy.date etc … etc…
But I couldn’t… could you help me, please?

Thank you very much,
Paloma
    [[alternative HTML version deleted]]


______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list