【发布时间】:2019-12-19 17:15:34
【问题描述】:
我有一个包含 3 列的 data.frame:
telar <- data.frame(
class = c("A","B","A","B"),
date = as.Date(c("2019-01-01", "2019-01-01", "2019-02-01", "2019-02-01")),
number = c(10, 20, 11, 21)
)
第一个包含类,第二个包含日期,第三个包含日期。我想创建一个多元时间序列矩阵,可由 hts 包中的 hts 函数使用。它应该是一个根节点,其余的是树的叶子。
代码应如下所示:
nodes <- list(length(unique(telar)))
## Here something to create the new time series matrix
my_hts <- hts(new_time_series_matrix, nodes)
谢谢大家!
【问题讨论】:
标签: r time-series