📜  如何以年为单位转换天数 - R 编程语言代码示例

📅  最后修改于: 2022-03-11 14:51:59.285000             🧑  作者: Mango

代码示例1
The lubridate package contains a built-in function, time_length, which can help perform this task.

time_length(difftime(as.Date("2003-04-05"), as.Date("2001-01-01")), "years")
[1] 2.257534

time_length(difftime(as.Date("2017-03-01"), as.Date("2012-03-01")),"years")
[1] 5.00274