[R-SIG-Finance] Cross correlation problems

wlblount bill at easterngrain.com
Fri Apr 5 19:16:45 CEST 2013


so then the above with 4 symbols works fine, but when you add a symbol

library(quantmod) 

sym1 <- "SPY" 
sym2 <- "ILF" 
sym3 <- "EWZ" 
sym4 <- "DIA"  
sym5 <- "EPP"
initDate <- "2010-01-01" 
getSymbols(sym1,from=initDate) 
getSymbols(sym2,from=initDate) 
getSymbols(sym3,from=initDate) 
getSymbols(sym4,from=initDate) 
getSymbols(sym5,from=initDate) 

df <- data.frame( dailyReturn(get(sym1)), dailyReturn(get(sym2)), 
                  dailyReturn(get(sym3)), dailyReturn(get(sym4)),
			dailyReturn(get(sym5))) 
names(df) <- c(sym1,sym2,sym3,sym4,sym5) 
print(round(cor(df),2))





you get an error message.  what am i missing?



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



More information about the R-SIG-Finance mailing list