Randy Zelick <[EMAIL PROTECTED]> writes:

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

"\t" for TAB
 
> 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!

Someone did that for you. Check out the xtable package.

> So is there a function for producing a file on disk with the same
> formatting as the screen?

sink() might well do it.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])             FAX: (+45) 35327907

______________________________________________
[EMAIL PROTECTED] 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

Reply via email to