R中的每小时日期序列 [英] Hourly Date Sequence In R

查看:37
本文介绍了R中的每小时日期序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试每隔一小时生成一系列日期.例如,我尝试了以下操作:

I am trying to produce a sequence of dates at hourly intervals. As an example I tried the following:

> seq(as.Date("1912-02-24 23:00:00"), as.Date("1912-02-25 08:32:00"), by="hour")

会产生错误,但它在 by= 年、月、日时工作正常.

which produces an error, yet it works fine for by= year, month, day.

seq.POSIXt {base} 的文档指出它应该在小时、秒、分钟等时间内工作,但所有这些都会产生错误.

The documentation for seq.POSIXt {base} states that it should work for hour, sec, min, etc, yet all of these produce an error.

> ?seq.POSIXt

提前致谢.

推荐答案

好吧,你自己不给答案 ;-)

Well, don't you give the answer yourself ;-)

关于:

seq(as.POSIXct("1912-02-24 23:00:00"), as.POSIXct("1912-02-25 08:32:00"), by="hour")

(也适用于 as.POSIXlt).

这篇关于R中的每小时日期序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆