Skip to content
Prev 177463 / 398503 Next

Loop question

Brendan Morse wrote:
I think you're basically looking for

http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-turn-a-string-into-a-variable_003f

or

http://wiki.r-project.org/rwiki/doku.php?id=tips:data-misc:create_var_names

but see the comments in both places that indicate why it may be easier to do
this
as a list.

for(i in 1:10){
	assign(paste("t1",i,sep=""),matrix(rnorm(250)))
}