Hi, I haven't spent too much time on it, but that might help: if (coint_tests[[i]]=="YES")... Note the double "=" which is the operator for equality. The single "=" is the assignment operator, especially with arguments.
HTH, Ivan Le 8/19/2010 09:03, Ferreira, Thiago Alves a écrit : > 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 > > ______________________________________________ > 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. > -- Ivan CALANDRA PhD Student University of Hamburg Biozentrum Grindel und Zoologisches Museum Abt. Säugetiere Martin-Luther-King-Platz 3 D-20146 Hamburg, GERMANY +49(0)40 42838 6231 ivan.calan...@uni-hamburg.de ********** http://www.for771.uni-bonn.de http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php [[alternative HTML version deleted]]
______________________________________________ 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.