Re: [R] Save output

From: Romain Francois <francoisromain_at_free.fr>
Date: Mon 03 Oct 2005 - 22:11:11 EST

Le 03.10.2005 12:30, Frank Schmid a écrit :

> Dear R-Mastermind
>
>
> Within a while or a for-loop, is there a way that I can save to disk the
> results of the previous calculations at the end of each loop with
> filenames
> called "file01.Rdata", "file02.Rdata" etc?
>
> So far, I have tried to write the outcome of each loop in a 3 dimensional
> array and saved it just once after the loop. Or is there another way
> so that
> I can keep the resulting matrix of every step in the loop?
>
> Thank you very much for your help
>
>
> Frank Schmid
>
>
?save
?sprintf

for(i in 1:12){
 tmp <- rnorm(10) # change it with your computations  save(tmp, file=sprintf('file%02d.RData',i)) }

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
~~~~~~      Romain FRANCOIS - http://addictedtor.free.fr         ~~~~~~
~~~~        Etudiant  ISUP - CS3 - Industrie et Services           ~~~~
~~                http://www.isup.cicrp.jussieu.fr/                  ~~
~~~~           Stagiaire INRIA Futurs - Equipe SELECT              ~~~~
~~~~~~   http://www.inria.fr/recherche/equipes/select.fr.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 Mon Oct 03 22:11:03 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 18:09:42 EST