On Sep 24, 2009, at 10:20 AM, Thomas Lumley wrote:

On Mon, 21 Sep 2009, David Winsemius wrote:


On Sep 21, 2009, at 5:52 PM, Martin Batholdy wrote:
I use xtable to convert data.frames to html tables.
But when I use the print-command I always get the whole output printed
even if I just want to save the html table into a variable;

How can I suppress that output is printed?

Perhaps by diverting it somewhere else? (after the example in xtable's help page)

capture.output(print(tli.table, type="html"), file="HTout.html")

R is not an HTML editor, so it would seem less than intuitive to send it to a character variable. It would not work to assign the value of capture.output since that is an invisible NULL.


If that were true, capture.output() would be pretty useless. The returned value is NULL if the file= argument is specified, otherwise it is the captured output.

Thanks for the correction. I was not reading the help page correctly.

table <- capture.output(print(xtable(CERAT), type="html")) # would have been the correct answer.
--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
R-help@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.

Reply via email to