Re: [R] Printing a variable in a loop

2012-06-28 Thread kat_the_great
Hi Oliver, Thank you for your reply. I can't use vectors as each var_1, var_2 is a new column/variable, not a new observation within a vector. But thank you, Kat -- View this message in context: http://r.789695.n4.nabble.com/Printing-a-variable-in-a-loop-tp4634673p4634756.html Sent from the

Re: [R] Printing a variable in a loop

2012-06-28 Thread kat_the_great
Thanks for your reply Jon. I need to actually do more than print the name of the variable (I just made the example simpler). I need to manipulate var_1, var_2 etc. but setting values of NA to 0. So as you said, "1. if you want to "display" the variable, just type it >var_1 " But how do I do

[R] Printing a variable in a loop

2012-06-27 Thread kat_the_great
Dear R Users: I'm a STATA user converting to R, and I'd like to be to do the following. #Assign var_1 and var_2 a value 10->var1 20->var2 #Now I'd like to print the values of var_1 and var_2 by looping through var_1 and var_2 in such a manner: while(y<3){ print(var_y) y+1->y } In STATA, the