I have a JulianDay column without year (dat$BeginJD
) and I have a Year column (dat$Year
). I need a single column with mm/dd/yyyy, extracted from both columns (dat$BeginDate
).
The data.frame looks like this:
> head(dat); tail(dat)
Year BeginJD BeginDate
1976 3 NA
1977 NA NA
1978 4 NA
1979 2 NA
1980 15 NA
1981 NA NA
2010 15 NA
2011 343 NA
2012 7 NA
2013 354 NA
2014 360 NA
2015 337 NA
I want the data.frame to look like this:
> head(dat); tail(dat)
Year BeginJD BeginDate
1976 3 1/3/1976
1977 NA NA
1978 4 1/4/1978
1979 2 1/2/1979
1980 15 1/15/1980
1981 NA NA
2010 15 1/15/2010
2011 343 12/9/2011
2012 7 1/7/2012
2013 354 12/20/2013
2014 360 12/26/2014
2015 337 12/3/2015
I've tried code using lubridate
and chron
packages with no luck.
Using R 3.2.1 and RStudio 0.99.467