[R-SIG-Finance] [R-sig-finance] quantmod: dailyReturn on a list of variables

Jeff Ryan jeff.a.ryan at gmail.com
Wed Nov 5 23:20:01 CET 2008


nbAssets in your code is simply the number 3.

Try:

myRet <- sapply(list(STOXX50E,GSPC,N225), dailyReturn)
cbind(myRet[[1]], myRet[[2]], myRet[[3]])

HTH
Jeff


On Wed, Nov 5, 2008 at 4:08 PM, patzoul <patzoul at free.fr> wrote:
>
> I run the following code:
> myAssets <- c("STOXX50E", "GSPC", "N225")
> nbAssets <- NROW(myAssets)
> myIndices <- paste("^", myAssets, sep="")
> getSymbols(myIndices)
>
> I would then like to apply the dailyReturn function on the 3 sets of data
> that I loaded.
>
> If I do dailyReturn(myAssets[1]) I get an error message.
>
> What do I need to change?
>
>
>
> --
> View this message in context: http://www.nabble.com/quantmod%3A-dailyReturn-on-a-list-of-variables-tp20349043p20349043.html
> Sent from the Rmetrics mailing list archive at Nabble.com.
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>



-- 
Jeffrey Ryan
jeffrey.ryan at insightalgo.com

ia: insight algorithmics
www.insightalgo.com



More information about the R-SIG-Finance mailing list