[R] exporting data.frame

Thomas Lumley tlumley at u.washington.edu
Fri May 10 17:10:49 CEST 2002


On Fri, 10 May 2002, Wataru Shito wrote:

> Hello,
>
> Is there any simple command to write the data.frame to the file in the
> format of command line input?
>
> For example, I read a table as
>
>   > data <-  read.table()
>
> and want to write out the 'data' object into my R file as
>
>   data <- data.frame( some.column1=c( 1, 2 ),
>                       some.column2=c( 1, 2 )
>                       row.names=c("row name1", "row name2" )
>
> so I don't have to type the data again in my library file to provide
> demos.

The dump() and dput() commands do this.  You could also use save() to save
an R binary file -- these are compatible across platforms and are
compressed to take up less space than dump()s.

	-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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