[R] write in a file

Agustin Lobo alobo at ija.csic.es
Tue Mar 19 10:48:57 CET 2002


write() for ascii, save() for binary. With write()
you can use append=T for puting all the vectors in the same
file (better as rows). 

To recover them to a matrix having used write(...,append=T)
matriz <- matrix(scan("outputfile.txt"),byrow=T,ncol=numcol.in.file)
matriz <- t(matriz) #if the vectors had been written as rows

>From save(), use load().

Perhaps you should consider one of the tutorials
in http://cran.r-project.org/other-docs.html

Agus

Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo at ija.csic.es


On Mon, 18 Mar 2002, Francisco J Molina wrote:

> I have a script that generates vectors (one in a while) How can I write
> them to a file?
> 
> How can I recover them and put them in a matrix (or some array where I
> can introduce more vectors)?
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list