Skip to content

*** saving files ***

3 messages · Shahrokh Keiwani, vincent@7d4.com, Jean Eid

#
Shahrokh Keiwani a ??crit :
for (i in 1:n)
{
myfilename = paste("file_" , i , sep="");
...
}
hih
#
If your loop is from 1:n then you can do the following. suppose you call
the resulslts results 1:n using assign or something. so like this

for(i in 1:n){
assign("results_", i, sep=""), lm(bla bla))
save(get(
+ temp <- paste("results_", i, sep="")
+ assign(temp, rnorm(i))
+ save(list=temp, file=temp)
+ }
[1] "results_1"  "results_10" "results_2"  "results_3"  "results_4"
 [6] "results_5"  "results_6"  "results_7"  "results_8"  "results_9"

P.S. If you need to call your results within the loop do something like
temp2<-get(temp)

and you can use temp2 as any regular object

HTH
On Wed, 14 Sep 2005, Shahrokh Keiwani wrote: