将Julian日期转换为R中的数据框内的日历日期 [英] Convert Julian date to calendar dates within a data frame in R
本文介绍了将Julian日期转换为R中的数据框内的日历日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个数据框架
> df
Age year sex
12 80210 F
13 9123 M
我想将80210年转换为26june1982。如何做到这一点,新的数据框架包含从朱利安日起的白天的年份。
I want to convert the year 80210 as 26june1982 . How can I do this that the new data frame contains year in day month year formate from Julian days.
推荐答案
你可以转换朱利安日期到日期使用 as.Date
并指定适当的来源:
You can convert Julian dates to dates using as.Date
and specifying the appropriate origin:
as.Date(8210, origin=as.Date("1960-01-01"))
#[1] "1982-06-24"
然而,80210需要很久以前的起源。
However, 80210 needs an origin pretty long ago.
这篇关于将Julian日期转换为R中的数据框内的日历日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文