On Mon, 31 Jan 2011, eric wrote:
> I'd rather do this without getting into zoo objects at the moment. OK, how
> about with a simple loop ? Why doesn't this work ?
>
> attach(xyz)
> j <- for(i in 4: length(Close)) sd(Close[i]:Close[(i-3)])

To answer your question, it is because the value returned from a loop is the 
last value 
calculated, not every value calculated.

HTH,
Ray Brownrigg

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to