Convert Julian date to calendar dates within a data frame

前端 未结 3 529
南方客
南方客 2020-12-20 18:18

I have a data frame

> df
Age   year  sex
12    80210  F
13     9123  M

I want to convert the year 80210 as 26june1982. How can I do this t

3条回答
  •  醉话见心
    2020-12-20 19:07

    You should substract the origin from the year column.

     as.Date(c(80210,9123)-80210,origin='1982-06-26')
    [1] "1982-06-26" "1787-11-08"
    

提交回复
热议问题