[R] Mayday ! Needing urgent help about writing results to a file

Peter Dalgaard p.dalgaard at biostat.ku.dk
Fri Nov 17 10:52:43 CET 2006


Marc Feuerstein <marc_feuerstein at yahoo.com> writes:

> Hey listmembers,
> I am desperately trying to write a data frame to a file. Not in CSV, but as they "appear" on the screen (nice, easy to read tables). I've read that the sink function is the way to go.
> 
> I have tried the following code inside a function. 
> 
> sink("ABC.txt")
> MyFrameA
> MyFrameB
> sink()
> 
> It gives the result I need when I use it outside a function, but when I use it *inside* a function I wrote, it creates an empty file. I want to pull my hair out !
> 
> What should I do so that, when the function ends, I have a text file called ABC.txt having MyFrameA and MyFrameB in the same file. 

Have a look at related issue in FAQ 7.16

> Thanks so much (in advance) to help me out on this one ! I'm sure some of you already encountered such a situation.
> 
> Marc.

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list