一个简单的问题:
# 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月分别对应多少小时。当然,我需要对来自不同年份的成千上万个数据进行这样的操作,但循环不是我的问题。有什么建议吗?谢谢!