This is actually FAQ 7.21 (though the FAQ does not specify how to create the
name in a loop). As others have mentioned, the most important part of the
Answer is that it is better to use a list instead.
What searching did you do before posting? Is there some way that the FAQ could
be changed t
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-
Tena koe Maciek
It is possible; e.g.:
i <- 3
assign(paste('myVar', i, sep=''), 1:5)
myVar3
[1] 1 2 3 4 5
Personally, I find it is more convenient to use a list so that instead of
myVar1, myVar2 etc I have a list object, myVar, with each element equivalent to
myVar1, myVar2 etc.
HTH ...
Peter
3 matches
Mail list logo