[R] formatted table to disk

Jan Goebel jgoebel at diw.de
Wed Apr 21 18:36:00 CEST 2004

What about sink()?
see help(sink)



On Wed, 21 Apr 2004, Randy Zelick wrote:

> Hello there,
> Using R 1.8.1 and WinXP...
> I would like to write a disk file (ascii text) of an R data frame. When I
> type the name of the object in the console window, it is sensibly and
> nicely formatted. When I use write.table, it is *not*, because the
> separation character is just a space.
> I looked through the introductory material (my level) on the R website,
> but did not find a reference to this issue.
> At a minimum I suppose there is a way to insert a tab character in the
> sep=" " field, but I don't know how to do that. Alternatively, I could
> deal with a variable specifying fixed-field widths for each of the
> variables in the frame. Didn't find that either.
> Even so, you would loose the right-justification and the fact that R seems
> to take into account the width of the largest value in a column.
> Of course the really slick deal would be to have paginated output where
> the column titles repeat at the top of the page (having entered a
> parameter for the number of lines on your page after margins and so
> forth).
> A somewhat brutal solution would be to create all the text strings for
> making a LaTex document/table environment and write all that stuff out to
> the text file. Please don't tell me I have to do that!
> So is there a function for producing a file on disk with the same
> formatting as the screen?
> Thanks,
> =Randy=
> R. Zelick				email: zelickr at pdx.edu
> Department of Biology			voice: 503-725-3086
> Portland State University		fax:   503-725-3888
> mailing:
> P.O. Box 751
> Portland, OR 97207
> shipping:
> 1719 SW 10th Ave, Room 246
> Portland, OR 97201
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

 Jan Goebel 
 j g o e b e l @ d i w . d e

 DIW Berlin 
 German Socio-Economic Panel Study (GSOEP) 
 Königin-Luise-Str. 5
 D-14195 Berlin -- Germany --
 phone: 49 30 89789-377

More information about the R-help mailing list