In Stata, you can create a bunch of similarly named variables, differing only in a number (Var1, Var2, ...; Vbl1, Vbl2, ...) by doing:
forvalues i = 1/30{
generate Var`i' = %some way of generating the variable
generate Vbl`i' =
}
Is there a way of doing this in R? I have code that generates variables, but I'd like to streamline it. What I really want is, is there some equivalent to the `i' ? I.e. some way to define a local macro, iterate over it, and use it in variable names?
This seems like the answer to this question might help ( R equivalent of Stata's for-loop over macros ), so apologies if it's redundant.