【发布时间】:2018-11-09 13:10:40
【问题描述】:
一个简单的问题:
# Given the following initial time
t0 <- strptime('17/Nov/2010:08:04:21',format='%d/%b/%Y:%H:%M:%S')
# ...and final time
t1 <- strptime('21/Jan/2011:13:11:04',format='%d/%b/%Y:%H:%M:%S')
# I can calculate the difference of time
difftime(t1,t0,units='hours')
# Time difference of 1565.112 hours
但是,我还想知道分别对应于 11 月、12 月和 1 月的小时数。当然,我必须对来自不同年份的数千个数据执行此操作,但循环不是我的问题。任何想法?谢谢!
【问题讨论】:
-
你能稍微弄清楚你到底需要什么输出吗?
标签: r time difference monthcalendar