I wonder if there is a simple way to produce a list of variables using a for loop, and give its value.
for(i in 1:3)
{
noquote(paste("a",i,sep=""))=i
}
In the above code, I try to create a1, a2, a3, which assign to the values of 1, 2, 3. However, R gives an error message. Thanks for your help.
namesparameter and later either just use it,attachit or convert it into an environment withlist2envandevalinside it. With no loops, parse or other ugly stuff. – mbq♦ May 16 '11 at 10:38list2envis a relatively new function. And still it will produce the variables in the some environment, when the OP wants to get the variables in the top environment. So the ugliness still remains :) – mpiktas May 16 '11 at 10:49.GlobalEnvis precisely what I try to omit. – mbq♦ May 16 '11 at 11:52