[R] *** saving files ***
Jean Eid
jeaneid at chass.utoronto.ca
Wed Sep 14 16:16:14 CEST 2005
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 at 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
>
More information about the R-help
mailing list