【问题标题】:ts.union for time series with a name pattern Rts.union 用于具有名称模式 R 的时间序列
【发布时间】:2022-01-28 16:49:22
【问题描述】:

我有一些时间序列,在 R 环境中名称中有后缀“_edg”。

> ls(pattern = "_edg")
[1] "cpi_c_edg"   "gc_c_edg"    "gdp_c_edg"   "t_dep_c_edg"

我想这样做:

e1 <- window(ts.union(cpi_c_edg, gc_c_edg, gdp_c_edg, t_dep_c_edg))

但不是命名所有系列,而是使用一个代码来获取所有时间系列,并在其名称中使用某种模式(“_edg”)。

提前致谢!

【问题讨论】:

    标签: r time-series environment-variables


    【解决方案1】:

    使用mgetlist 中返回它们

    window(do.call(ts.union, mget(ls(pattern = "_edg"))))
    

    【讨论】:

      猜你喜欢
      • 2020-11-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-20
      • 2017-02-08
      • 1970-01-01
      • 1970-01-01
      • 2017-02-02
      相关资源
      最近更新 更多