【发布时间】:2020-11-20 13:03:09
【问题描述】:
有没有人有更简洁的方法将 lubridate period 和 duration 对象舍入到分钟而不是秒。
例如,我有以下代码管道:
seconds(x = 3600115) %>% as.duration() %>% as.period()
这将导致:41d 16H 1M 55S。我想将其四舍五入,使其变为:41d 16H 2M 0S。
有没有人知道比以下更好的方法:
(seconds(x = 3600115) / 60) %>% as.numeric() %>% round() %>% dminutes() %>% as.period()
这会导致:41d 16H 2M 0S
【问题讨论】: