Just type the name of the function into the command line (no parentheses
or arguments- just type "getYahooData" or "cReturns").

It looks like your ttr definition is causing the problem- there's no
"sma" function there unless you've loaded it from another library. Try
something like this instead:

        
        library(TTR); library(ttrTests); library(quantmod)
        spData <- as.vector(getYahooData('SPY', start = 19900101, end =
        20081231)[,'Close'])
        cr <- cReturns(spData, ttr = 'macd4')

Note that if you use the functions in the "MovingAverages" function set
in quantmod, those functions will try to convert a vector series into an
xts object. Since your vector series has no names for the indices, it's
a bit of a problem because the conversion results in an error.

On Thu, 2010-07-08 at 22:41 +0100, Raghu wrote:

> spData <-
> as.vector(getYahooData("SPY",start="19900101",end="20081231")[,"Close"])
> > cr <- cReturns(spData, ttr = "sma", params=c(20))
> Error in ind[t - k] <- pos[t - k + 1] - pos[t - k] :
>   replacement has length zero
> 
> I am getting the above error when running the cReturns function. Any ideas
> on this? How does one drill down into finction codes in R?
> 
> Tx
> Raghu
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-SIG-Finance@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.
> -- Also note that this is not the r-help list where general R questions should go.
> 



	[[alternative HTML version deleted]]

