On Aug 20, 2010, at 1:07 PM, Gonçalo Ferraz wrote:
Hi,
I am writing a for loop that creates one object, say 'outn' on every
round of the loop. I would like the name of each object to include
the index of the loop as in, for example:
out1, out2, out3, ...
?assign
?paste
And I would l
The quick answer is to use a list.
The most simple:
outlist=list()
for (i in 1:10){
outlist[[i]] = matrix(rnorm(100), 10, 10)
}
Same example, but with naming:
outlist=list()
for (i in 1:10){
outlist[[i]] = data.frame(loop_number=i, matrix(rnorm(100), 10, 10))
}
now if you were to do
final_
Gonçalo Ferraz wrote:
Hi,
I am writing a for loop that creates one object, say 'outn' on every
round of the loop. I would like the name of each object to include the
index of the loop as in, for example:
out1, out2, out3, ...
And I would like the naming of the object to take place automat
Hi,
I am writing a for loop that creates one object, say 'outn' on every
round of the loop. I would like the name of each object to include the
index of the loop as in, for example:
out1, out2, out3, ...
And I would like the naming of the object to take place automatically
as the loop mo
4 matches
Mail list logo