Reputation: 291
I currently have dates in the format mdd (single or double digit month and double digit day), with the year in a separate column.
Here is an example of what the data looks like:
Year Date
1996 921
1996 923
1996 1001
1996 1127
1997 502
I would like to combine these and convert them to julian dates. Can anyone help me with this? I don't know why this data has been collected in such an awkward format.
Thank you so much in advance for your help - code for R or excel will be fine!
Upvotes: 0
Views: 1506
Reputation: 34265
In Excel
=DATE(A2,INT(B2/100),MOD(B2,100))
Where the year is in A2 and the month/day in B2.
Upvotes: 2
Reputation: 887511
We can use sprintf
as.POSIXlt(sprintf('%04d%04d', df1$Year, df1$Date),
format ='%Y%m%d')$yday
#[1] 264 266 274 331 121
Upvotes: 2