相关疑难解决方法(0)

R 中的每小时时间序列。 ts(... start) 是如何工作的?

试图在 R 中每小时创建一个时间序列。

我有一个收集每小时车辆数量的数据框,它看起来像:

> head(df)
# A tibble: 6 x 8
      interval             cars  vans trucks total `mean speed` `% occupation`  hour
      <dttm>              <int> <int>  <int> <int>        <dbl>          <dbl> <int>
    1 2017-10-09 00:00:00     7     0      0     7         7.37             1.     0
    2 2017-10-09 01:00:00    24     0      0    24        16.1              3.     1
    3 2017-10-09 02:00:00    27     0      0    27        18.1              2.     2
    4 2017-10-09 03:00:00    47     3      0    50        31.5              3.     3
    5 2017-10-09 04:00:00   122     1      5   128        48.0             16.     4 …
Run Code Online (Sandbox Code Playgroud)

r time-series

5
推荐指数
1
解决办法
1458
查看次数

分解xts每小时时间序列

我想用decomposeets、 或stl或任何函数分解每小时时间序列。这是示例代码及其输出:

require(xts)
require(forecast)
time_index1 <- seq(from = as.POSIXct("2012-05-15 07:00"),
                   to = as.POSIXct("2012-05-17 18:00"), by="hour")
head(time_index1 <- format(time_index1, format="%Y-%m-%d %H:%M:%S",
                           tz="UTC", usetz=TRUE)
# [1] "2012-05-15 05:00:00 UTC" "2012-05-15 06:00:00 UTC"
# [3] "2012-05-15 07:00:00 UTC" "2012-05-15 08:00:00 UTC"
# [5] "2012-05-15 09:00:00 UTC" "2012-05-15 10:00:00 UTC"
head(time_index <- as.POSIXct(time_index1))
# [1] "2012-05-15 05:00:00 CEST" "2012-05-15 06:00:00 CEST"
# [3] "2012-05-15 07:00:00 CEST" "2012-05-15 08:00:00 CEST"
# [5] "2012-05-15 09:00:00 CEST" "2012-05-15 10:00:00 CEST"
Run Code Online (Sandbox Code Playgroud)

为什么时区 …

r posixct xts

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

r ×2

posixct ×1

time-series ×1

xts ×1