[R-SIG-Finance] R - Error Question for chart.Correlation(PerformanceAnalytics)

Guy Yollin guy.yollin at rotellacapital.com
Tue Jan 8 20:04:01 CET 2008


Interesting, I wasn't calling data(managers), I was just calling
library(PerformanceAnalytics) and then accessing the dataframe:

> head(managers)
   X.Y..m..d    HAM1 HAM2    HAM3    HAM4 HAM5 HAM6 EDHEC.LS.EQ SP500.TR
1 1996-01-31  0.0074   NA  0.0349  0.0222   NA   NA          NA   0.0340
2 1996-02-29  0.0193   NA  0.0351  0.0195   NA   NA          NA   0.0093
3 1996-03-31  0.0155   NA  0.0258 -0.0098   NA   NA          NA   0.0096
4 1996-04-30 -0.0091   NA  0.0449  0.0236   NA   NA          NA   0.0147
5 1996-05-31  0.0076   NA  0.0353  0.0028   NA   NA          NA   0.0258
6 1996-06-30 -0.0039   NA -0.0303 -0.0019   NA   NA          NA   0.0038
  US.10Y.TR US.3m.TR
1   0.00380  0.00456
2  -0.03532  0.00398
3  -0.01057  0.00371
4  -0.01739  0.00428
5  -0.00543  0.00443
6   0.01507  0.00412

I see that calling data(managers) first supplies the dataframe with the
expected format; thanks for the clarification.  I don't know enough
about building packages to know if this is the expected behavior or not.

Best,

-- G

-----Original Message-----
From: Peter Carl [mailto:peter at braverock.com] 
Sent: Tuesday, January 08, 2008 9:40 AM
To: r-sig-finance at stat.math.ethz.ch
Cc: Guy Yollin; MAB
Subject: Re: [R-SIG-Finance] R - Error Question for
chart.Correlation(PerformanceAnalytics)

On Tuesday 08 January 2008 10:08:06 am Guy Yollin wrote:
> Also, it appears that a couple of the datasets (managers and edhec)
have
> what should really be the rownames as the first column of data in the
> dataframe.

Can you clarify this?  How are you loading the data?  The examples,
which are 
all run (tested) as part of the submission to CRAN, simply load the data

using: 

> data(managers)
> head(managers)
            HAM1 HAM2    HAM3    HAM4 HAM5 HAM6 EDHEC.LS.EQ SP500.TR
US.10Y.TR
Jan 1996  0.0100   NA  0.0359  0.0208   NA   NA          NA   0.0340
0.00380
Feb 1996  0.0215   NA  0.0295  0.0231   NA   NA          NA   0.0093
-0.03532
Mar 1996  0.0226   NA  0.0253 -0.0053   NA   NA          NA   0.0096
-0.01057
Apr 1996  0.0008   NA  0.0478  0.0200   NA   NA          NA   0.0147
-0.01739
May 1996  0.0158   NA  0.0337  0.0122   NA   NA          NA   0.0258
-0.00543
Jun 1996 -0.0086   NA -0.0293 -0.0089   NA   NA          NA   0.0038
0.01507
         US.3m.TR
Jan 1996  0.00456
Feb 1996  0.00398
Mar 1996  0.00371
Apr 1996  0.00428
May 1996  0.00443
Jun 1996  0.00412

If you use read.csv, you'll want to set row.names=1 so to capture the 
appropriate label.

Also, these data objects are now zoo objects and degrade nicely with
as.matrix 
and other similar functions.

pcc
-- 
Peter Carl
145 Scottswood Rd
Riverside, IL 60546
708 447 6465



More information about the R-SIG-Finance mailing list