Convert day of year to date

I found that @TMS answer ignores the year specified in the origin, replacing it with the actual year you are executing the command (as @Shekeine found). Doing this seems to work fine though:

as.Date(104, origin = "2014-01-01")

CAUTION: day-of-year is zero based in this case!


This is the way I do it:

as.Date(104, format = "%j", origin = "1.1.2014")
# "2014-04-15"

PS: for those who wonder if answering my own question is encouraged, please look here: https://meta.stackexchange.com/questions/17463/can-i-answer-my-own-questions-even-if-i-knew-the-answer-before-asking