在数据框中将儒略日期转换为日历日期 [英] Convert Julian date to calendar dates within a data frame
本文介绍了在数据框中将儒略日期转换为日历日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个数据框
> 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.
推荐答案
您可以转换朱利安使用作为日期
并指定适当的原点的日期:
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.
这篇关于在数据框中将儒略日期转换为日历日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文