[英]How to create a timeseries for the data which is collected every 1 hour with a time interval of 15 minutes
數據從 (2019-01-01 00:00:00.0) 到 (2019-04-15 23:45:00.0)
我試過這個:
prodapt.ts.PmdAve <- ts(prodapt[,30], start = c(2019,1), frequency = 4)
我想要每小時的時間序列,以 15 分鍾的時間間隔記錄。
使用seq
:
start <- as.POSIXct("2019-01-01 00:00:00.000", "%Y-%m-%d %H:%M:%OS")
end <- as.POSIXct("2019-04-15 23:45:00.000", "%Y-%m-%d %H:%M:%OS")
x <- seq(start, end, by=60*15)
x[c(1:10, (length(x)-9):length(x))]
[1] "2019-01-01 00:00:00" "2019-01-01 00:15:00" "2019-01-01 00:30:00"
[4] "2019-01-01 00:45:00" "2019-01-01 01:00:00" "2019-01-01 01:15:00"
[7] "2019-01-01 01:30:00" "2019-01-01 01:45:00" "2019-01-01 02:00:00"
[10] "2019-01-01 02:15:00" "2019-04-15 21:30:00" "2019-04-15 21:45:00"
[13] "2019-04-15 22:00:00" "2019-04-15 22:15:00" "2019-04-15 22:30:00"
[16] "2019-04-15 22:45:00" "2019-04-15 23:00:00" "2019-04-15 23:15:00"
[19] "2019-04-15 23:30:00" "2019-04-15 23:45:00"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.