如何将多个xts列表转换为一个xts对象?

时间:2022-05-23 19:37:45

I have a list named Rets with 33 xts class objects. Each one of those xts objects is "quarterly" and have daily returns of 3 different portfolios, like this:

我有一个名为Rets的列表,包含33 xts类对象。这些xts对象中的每一个都是“季度”,并且每日返回3个不同的投资组合,如下所示:

> print(Rets[[1]][,1:3])
           Equal.Weighted      MVLedoit      MVSample
2003-01-02   2.598379e-02  0.0074618827  0.0085061439
2003-01-03  -3.419687e-03 -0.0109129714 -0.0107993433
2003-01-06   3.120466e-02 -0.0027083783 -0.0011993601
.
.
.
2003-04-28   2.073540e-02  0.0026789571  0.0032035582
2003-04-29   1.492713e-02  0.0009878566 -0.0019401993
2003-04-30   2.898973e-04  0.0078070394  0.0074441371

> print(Rets[[2]][,1:3])
           Equal.Weighted      MVLedoit      MVSample
2003-05-02   0.0165136926  0.0084945856  9.398209e-03
2003-05-05  -0.0036702400  0.0092221437  8.448889e-03
2003-05-06  -0.0125257806  0.0014797926  6.905171e-04
.
.
.
2003-08-27   0.0131081444  0.0128875785  1.358910e-02
2003-08-28  -0.0028180975  0.0143124389  1.439714e-02
2003-08-29   0.0028192886  0.0050242460  4.571573e-03

How can I do to create a single xts object containing all information?

如何创建包含所有信息的单个xts对象?

Thank you!

谢谢!

1 个解决方案

#1


1  

@BondedBust Thank you for you comment. The command is easy as you say:

@BondedBust谢谢你的评论。你说这个命令很简单:

ALLRets <- do.call('rbind', Rets)

#1


1  

@BondedBust Thank you for you comment. The command is easy as you say:

@BondedBust谢谢你的评论。你说这个命令很简单:

ALLRets <- do.call('rbind', Rets)