Re: [R] use variable value to create new variable name

2011-06-14 Thread Greg Snow
Behalf Of maciek kryza > Sent: Monday, June 13, 2011 8:14 AM > To: r-help@r-project.org > Subject: [R] use variable value to create new variable name > > Hi, > Is it possible (and how) to use a variable value to create a name of a > new R > variable? I want to do someth

Re: [R] use variable value to create new variable name

2011-06-13 Thread jdanielnd
Actually it's highly discouraged to do that, since you lose control of the number of variables do you have, you spread them in different objects. It's much wiser to use a vector or a list to do that. -- View this message in context: http://r.789695.n4.nabble.com/use-variable-value-to-create-new-

Re: [R] use variable value to create new variable name

2011-06-13 Thread Peter Alspach
yVar1, myVar2 etc. HTH ... Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of maciek kryza > Sent: Tuesday, 14 June 2011 2:14 a.m. > To: r-help@r-project.org > Subject: [R] use variable value to create ne

[R] use variable value to create new variable name

2011-06-13 Thread maciek kryza
Hi, Is it possible (and how) to use a variable value to create a name of a new R variable? I want to do something like this: for (i in 1:3) { newvarialbe_#i# = somedata } where #i# is a value stored by i. In the first loop, there will be newvariable_1, in second newvariable_2 and so on. Thanks in