[R] What is the best way to have "R" output tables in an MS

(Ted Harding) Ted.Harding at manchester.ac.uk
Thu May 6 22:07:42 CEST 2010


Replying to Chris's latest message for the sake of preserving the
thread, but deleting all of it to save space. Except:

I had sympathy with Chris's original query, on the grounds that
it was a good enquiry in principle, essentially pokinting towards
the problem of incorporating R's formatted output (be it tables,
graphics, ... ) into document-preparation software, whether it
be noddy WYSIWYG like Word, or more sophisticated "typesetting"
software such as TeX, the Adobe stable and other DTP software,
or even the ancient UNIX troff dinosaur (re-evolved as GNU groff,but
stil roaming the plains and consuming tough typesetting for breakfast
just as its ancestor did).

Given what he said in his latest message, I now have even more
sympathy. It's not about begging in the streets for someone to
charitably do the job for him! It's a job that could be a service
to many, and if it attracts enough enthusiasm from enough of those
who know how to do it then they will willingly plunge in. That's
how Free Software works.

The issue is about the "enough enthusiasm" and the "enough of
those who know".

Many (possibly almost all) of the people who have developed R
are mainly working with TeX/LaTex. R clearly has a well-developed
interface to that language. But there are many people (of whom
Chris has raised his head) who have needs or preferences for other
software of whom some (as Chris spelled out) may totally lack
support for R and LaTex, etc., from their organisations.

I've pondered such issues many times myself, being one of the
old nomadic troff-herders and still herding the groffs.
My routine approach is as Chris described: grab the output from
R (be it mouse-copied off-screen, from a saved file, or for
graphics from a file of the coordinates of the graphical objects,
or an EPS file), plant this into a groff document, and wrap it
in formatting tags so that it comes out nicely. A bit time
consuming, but since it's fairly straightforward in a markup
language like g/troff, not so very time-consuming; and I dare
say the same would be true for TeX/LaTex if Sweave & Co did
not exist. However, I would hate to have to do it for Word and
the like! I bet that *is* time consuming.

All of which is leading on to a suggestion that has been lurking
in my mind for a while.

How about an R "device" called xml? This would implement the XML
"extensible markup language" which is basically capable of
encapsulating any formatted material.

The existing R devices seem to be confined to graphical output.
XML can in principle cope with anything. Naturally, its function
would be to save to file, not display on screen.

I believe that Word (and maybe other MS Office software) can import
XML. I know that XML can be converted to g/troff input (I've done it).
It can no doubt be converted to TeX/LateX input. I'm not familiar
enough with other document software to comment

Then we would have a "universal" language for formatted R output,
suitable for importing formatted R output into document preparation
software. One would not need the full functionality of XML.

Up to a point (I'm far from being an XML guru) I'd be prepared to
assist with this, and in particular to test it out with groff.

Any comments? Might there be a better suggestion than XML?

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 06-May-10                                       Time: 21:07:34
------------------------------ XFMail ------------------------------



More information about the R-help mailing list