[R] Loop and cbind

john seers (IFR) john.seers at bbsrc.ac.uk
Wed Jul 4 15:18:50 CEST 2007


In what way does it not work?

My guess is that you have not declared your values outside the for loop.
As they are local they will be lost on exit.

You need to declare them before:


for ... {

John Seers


Hi, I would like to apply the following function for i between 1 and 12,
and then construct a list of the return series.

for (i in 1:12){
ewma[i] <- emaTA(calm[[i]]^2,0.03)
standard[i]<- calm[[i]]/sqrt(ewma[i])
standard <- cbind(standard[i])

But it does not work. Could anyone give me some advice how can I achieve
this? Many thanks
View this message in context:
Sent from the R help mailing list archive at Nabble.com.

R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list