[R-SIG-Finance] Cross correlation problems

wlblount bill at easterngrain.com
Fri Apr 5 11:51:10 CEST 2013


just curious why this would not work

library(quantmod) 
getSymbols("SPY",src="google") 
getSymbols("ILF",src="google") 
getSymbols("EWZ",src="google") 
df = data.frame( dailyReturn(SPY), dailyReturn(ILF), dailyReturn(EWZ) ) 
names(df)<- c("SPY","ILF","EWZ") 
round(cor(df),2)

i assume it has to do with the "names" function.

can some one point me in the direction of... 

1 - using variables as to only have to input symbol once  

2 - how about expanding to 4 symbols (or any amount of 
symbols)

Thanks,
Bill




--
View this message in context: http://r.789695.n4.nabble.com/Cross-correlation-problems-tp4663151p4663403.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list