是否可以将分数年和日期转换为R?
中的实际日期格式例如,在我下面的示例数据的time
列中,1900.00对应于1900年1月,1900.08对应于2月。 dayofyr
对应于年份。
myData< - 结构(列表(时间= c(1900,1900,1900,1900,1900,1900,1900, 1900,1900,1900,1900,1900,1900,1900,1900,1900,1900,1900, 1900,1900,1900,1900,1900,1900,1900,1900,1900,1900,1900, 1900,1900,1900.08,1900.08,1900.08,1900.08,1900.08,1900.08, 1900.08,1900.08,1900.08,1900.08,1900.08,1900.08,1900.08, 1900.08,1900.08,1900.08,1900.08,1900.08,1900.08,1900.08, 1900.08,1900.08,1900.08,1900.08,1900.08,1900.08,1900.08, 1900.08,1900.08,1900.17,1900.17,1900.17,1900.17,1900.17, 1900.17,1900.17,1900.17,1900.17,1900.17,1900.17,1900.17, 1900.17,1900.17,1900.17,1900.17,1900.17,1900.17,1900.17, 1900.17,1900.17,1900.17,1900.17,1900.17,1900.17,1900.17, 1900.17,1900.17,1900.17,1900.17,1900.17,1900.25,1900.25, 1900.25,1900.25,1900.25,1900.25,1900.25,1900.25,1900.25, 1900.25,1900.25,1900.25,1900.25,1900.25,1900.25,1900.25, 1900.25,1900.25,1900.25,1900.25,1900.25,1900.25,1900.25, 1900.25,1900.25,1900.25,1900.25,1900.25,1900.25,1900.25, 1900.33,1900.33,1900.33,1900.33,1900.33,1900.33,1900.33, 1900.33,1900.33,1900.33,1900.33,1900.33,1900.33,1900.33, 1900.33,1900.33,1900.33,1900.33,1900.33,1900.33,1900.33, 1900.33,1900.33,1900.33,1900.33,1900.33,1900.33,1900.33, 1900.33,1900.33,1900.33,1900.42,1900.42,1900.42,1900.42, 1900.42,1900.42,1900.42,1900.42,1900.42,1900.42,1900.42, 1900.42,1900.42,1900.42,1900.42,1900.42,1900.42,1900.42, 1900.42,1900.42,1900.42,1900.42,1900.42,1900.42,1900.42, 1900.42,1900.42,1900.42,1900.42,1900.42,1900.5,1900.5, 1900.5,1900.5,1900.5,1900.5,1900.5,1900.5,1900.5,1900.5, 1900.5,1900.5,1900.5,1900.5,1900.5,1900.5,1900.5,1900.5, 1900.5,1900.5,1900.5,1900.5,1900.5,1900.5,1900.5,1900.5, 1900.5,1900.5,1900.5,1900.5,1900.5,1900.58,1900.58,1900.58, 1900.58,1900.58,1900.58,1900.58,1900.58,1900.58,1900.58, 1900.58,1900.58,1900.58,1900.58,1900.58,1900.58,1900.58, 1900.58,1900.58,1900.58,1900.58,1900.58,1900.58,1900.58, 1900.58,1900.58,1900.58,1900.58,1900.58,1900.58,1900.58, 1900.67,1900.67,1900.67,1900.67,1900.67,1900.67,1900.67, 1900.67,1900.67,1900.67,1900.67,1900.67,1900.67,1900.67, 1900.67,1900.67,1900.67,1900.67,1900.67,1900.67,1900.67, 1900.67,1900.67,1900.67,1900.67,1900.67,1900.67,1900.67, 1900.67,1900.67,1900.75,1900.75,1900.75,1900.75,1900.75, 1900.75,1900.75,1900.75,1900.75,1900.75,1900.75,1900.75, 1900.75,1900.75,1900.75,1900.75,1900.75,1900.75,1900.75, 1900.75,1900.75,1900.75,1900.75,1900.75,1900.75,1900.75, 1900.75,1900.75,1900.75,1900.75,1900.75,1900.83,1900.83, 1900.83,1900.83,1900.83,1900.83,1900.83,1900.83,1900.83, 1900.83,1900.83,1900.83,1900.83,1900.83,1900.83,1900.83, 1900.83,1900.83,1900.83,1900.83,1900.83,1900.83,1900.83, 1900.83,1900.83,1900.83,1900.83,1900.83,1900.83,1900.83, 1900.92,1900.92,1900.92,1900.92,1900.92,1900.92,1900.92, 1900.92,1900.92,1900.92,1900.92,1900.92,1900.92,1900.92, 1900.92,1900.92,1900.92,1900.92,1900.92,1900.92,1900.92, 1900.92,1900.92,1900.92,1900.92,1900.92,1900.92,1900.92, 1900.92,1900.92,1900.92),dayofyr = 1:366),class = c(“tbl_df”, “tbl”,“data.frame”),row.names = c(NA,-366L),. Name = c(“time”, “dayofyr”))
答案 0 :(得分:1)
使用\u2063foo foo
删除小数部分,转换为附加floor
的字符串,将其转换为"-01-01"
类,并添加天数减1.不使用任何包。
"Date"