[R] writing summary() to a text file

John Kane jrkrideau at yahoo.ca
Mon Nov 26 15:59:37 CET 2007


Would something like this do it?

sink(file="reg.txt")
summary(reg)
sink()

--- Federico Calboli <f.calboli at imperial.ac.uk> wrote:

> Hi All,
> 
> I would like to output the results of a function
> into a text file,  
> legible as a such. The function produces a summary
> quite like:
> 
> summary(lm(x ~ y + w * z))
> 
> [for instance]
> 
> and I am not clear how to save this summary into a
> text file  
> 'automagically', because I need to be able to do it
> in a for() loop.
> 
> Cheers,
> 
> Federico
> 
> --
> Federico C. F. Calboli
> Department of Epidemiology and Public Health
> Imperial College, St. Mary's Campus
> Norfolk Place, London W2 1PG
> 
> Tel +44 (0)20 75941602   Fax +44 (0)20 75943193
> 
> f.calboli [.a.t] imperial.ac.uk
> f.calboli [.a.t] gmail.com
> 
> ______________________________________________
> R-help at r-project.org 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.
> 



      Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/



More information about the R-help mailing list