我有几年的朱利安日期,我想将它们转换为标准日期格式(年 - 月 - 日)。我尝试使用以下代码
library(epitools)
library(dplyr)
df$new_date <- df %>%
group_by(year) %>%
mutate(new_date = julian2date(julian_date))
但它收到以下消息:
Error: do not know how to convert 'attributes(x)[[1]]' to class “Date”
答案 0 :(得分:0)
不需要julian2date()函数。以下代码会将julian_date变量转换为标准日期格式。
as.Date(julian_date, origin="1970-01-01")