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

Alain Guillet guillet at stat.ucl.ac.be
Fri Nov 17 10:57:21 CET 2006


This is an exercise of the lesson STAT2430 at the UCL. Please, do your 
homework alone!!!!

Marc Feuerstein a écrit :
> 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. 
> Thanks so much (in advance) to help me out on this one ! I'm sure some of you already encountered such a situation.
> Marc.
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Alain Guillet
Statistician and Computer Scientist

Institut de statistique - Université catholique de Louvain
Bureau d.126
Voie du Roman Pays, 20
B-1348 Louvain-la-Neuve

tel: +32 10 47 30 50

More information about the R-help mailing list