Re: [R] *** saving files ***

From: Jean Eid <jeaneid_at_chass.utoronto.ca>
Date: Thu 15 Sep 2005 - 00:16:14 EST

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(

> for(i in 1:10){

+ temp <- paste("results_", i, sep="")
+ assign(temp, rnorm(i))
+ save(list=temp, file=temp)
+ }

> dir()

 [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:

> Hi,
>
>
>
> I need help :o(
>
>
>
> I want that my function saves result files in a for()-loop while it runs
> automatically.
>
>
>
> the filenames must be saved like:
>
>
>
> file_1 -> for 1. result
>
> file_2 -> for 2. result
>
> file_3 -> for 3. result
>
>
>
> and
>
> .
>
> .
>
> .
>
>
>
> file_n -> for n. result
>
>
>
> the file names are the same identified by _1, _2 , _3, ... , _n
>
>
>
> these files will loaded by a second function later in the same sequence
> (_1 to _n).
>
>
>
> how can I do that ...
>
>
>
>
>
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Sep 21 02:30:57 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 17:18:25 EST