我真的需要你对以下问题的帮助:拆分数据帧为基于在XTS信息的多个数据帧对象
我有两个数据帧 - 含ISIN和群集信息证券的投资组合之一。
> dfInput
TICKER CLUSTER SECURITY.NAME
1 LU0937588209 High Yield Prime Capital Access SA SICAV-
2 LU0694362343 High Yield ECM CREDIT FUND SICAV - ECM Hi
3 IE0030390896 High Yield Putnam World Trust - Global Hi
4 LU0575374342 EM Debt Ashmore SICAV - Emerging Marke
5 LU0493865678 EM Debt Ashmore SICAV - Emerging Marke
6 LU0972237696 EM Debt Galloway Global Fixed Income F
7 IE00B6TLWG59 ILS/CAT GAM Star Fund PLC - Cat Bond F
8 LU0816333396 ILS/CAT LGT Lux I - Cat Bond Fund
9 LU0879473352 L/S Credit Merrill Lynch Investment Solut
10 HINCFEF ID Equity L/S Credit Hedge Invest International Fun
11 FR0011034800 L/S Credit Schelcher Prince Opportunite E
12 PIMCSEI ID Equity L/S Credit PIMCO Funds Global Investors S
13 VTR US Equity REITs Ventas Inc
14 HCP US Equity REITs HCP Inc
15 VGSIX US Equity REITs Vanguard REIT Index Fund
16 NLY US Equity M REITs Annaly Capital Management Inc
17 CLNY US Equity M REITs Colony Financial Inc
18 AGNC US Equity M REITs American Capital Agency Corp
19 REM US Equity M REITs iShares Mortgage Real Estate C
20 ES0130960018 Infrastructure Equities Enagas SA
21 SDRL US Equity Infrastructure Equities Seadrill Ltd
22 IGF US Equity Infrastructure Equities iShares Global Infrastructure
23 KMP US Equity MLP Kinder Morgan Energy Partners
24 EPD US Equity MLP Enterprise Products Partners L
25 MLPI US Equity MLP ETRACS Alerian MLP Infrastruct
26 HTGC US Equity BDC Hercules Technology Growth Cap
27 TCPC US Equity BDC TCP Capital Corp
28 MAIN US Equity BDC Main Street Capital Corp
29 BDCS US Equity BDC ETRACS Linked to the Wells Far
另含有多个时间序列这些证券与证券名称作为列名的回报率(该数据从一个Excel文件来)
> PortfolioR.xts
Ventas.Inc HCP.Inc ....
2011-01-03 0.0000000000 0.0000000000
2011-01-04 -0.0117725362 -0.0056323067
2011-01-05 -0.0081155489 0.0018809625
2011-01-06 -0.0009479572 -0.0154202974
2011-01-07 -0.0058974774 -0.0054674822
2011-01-10 -0.0074691528 -0.0077050464
2011-01-11 -0.0036591278 0.0052348928
2011-01-12 0.0132249172 -0.0091097938
2011-01-13 0.0015220703 0.0085600412
2011-01-14 0.0058762372 -0.0038567541
2011-01-17 0.0000000000 0.0000000000
2011-01-18 0.0157513101 -0.0002760525
2011-01-19 -0.0059712810 -0.0074823683
2011-01-20 0.0013092679 0.0049944610
2011-01-21 0.0013075560 -0.0055509440
...
我怎么能现在拆分XTS对象基于投资组合的集群信息?
结果应该是为每个CLUSTER
单独的data.frame
或xts
对象包含属于该集群的证券的返回历史记录。
这可能吗?
预先感谢您...
请指定问题的正确标记,以便其他人可以帮助您。除非没有人能看到你的问题。 –
对不起...我的第一篇文章在stackoverflow –