[R] writing summary() to a text file

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Mon Nov 26 15:47:58 CET 2007


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

You can either redirect output to a file using cat or sink; generate a 
latex table using xtable (in the xtable package); or export the relevant 
bits (e.g. the coefficients matrix) using write.csv.

Based upon your message, sink is probably your best bet/

sink(file="foo.txt")
summary(lm(x ~ y + w * z))
sink(NULL)

Regards,
Richie.

Mathematical Sciences Unit
HSL


------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}



More information about the R-help mailing list