[R] Help with Vectors and conditional functions

Ferreira, Thiago Alves thiago.alves.ferreira at citi.com
Thu Aug 19 09:03:37 CEST 2010


Good morning,

I have something like this: names(coint_tests) <- apply(b,2,paste, collapse="_") which prints 15 names like: A_B, C_D, E_F, ...
AA,B,C,D.. Are time series. Then there is a vector called coint_tests of length 15 which yields "yes" or "no".

I need to add a function to plot the time series Ai_Bi if the coint_tests vectors gives me a "YES".


I tried:    for (i in 1:(length(coint_tests))
                        if (coint_tests[[i]]="YES") {plot(coint_tests[i])}

But it does not work. I would most appreciate if someone could give me some insight as to how to sort this out. Thank you



More information about the R-help mailing list