[R] Transferring R results to word prosessors

Gabor Grothendieck ggrothendieck at gmail.com
Fri Feb 10 14:28:02 CET 2006


On 10 Feb 2006 12:39:43 +0100, Peter Dalgaard <p.dalgaard at biostat.ku.dk> wrote:
> Gabor Grothendieck <ggrothendieck at gmail.com> writes:
>
> > Yes, the R2HTML route is probably the quickest.  Its just one line
> > of code (plus the call to load in R2HTML).  Try this where iris
> > is a data set built into R:
> >
> >    library(R2HTML)
> >    HTML( iris, file("clipboard","w"), append=FALSE )
> >
> > Now paste the clipboard into Excel and from there into Word.
> >
> > (If you are using OO Calc instead of Excel then you need to do:
> >     Edit | Paste Special | HTML Format | OK
> > in Calc.)
>
> Er, if you need to go via Excel anyway, wouldn't it be easier to just
> use write.table or write.csv/write.csv2? The real value in R2HTML
> would seem to be if you could go directly to Word/OO Writer.

The data frame was just an example.  The real problem stated by
the user included transferring summary.lm and presumably other
classes of object as well. The HTML solution also in those cases
as it has 158 HTML methods including a summary.lm method.

Another poster did point out already one can create a file from R2HTML
and insert that into Word thereby eliminating the Excel step; however,
I think its actually faster to go the Excel route since that way you don't have
to locate the file in Word but I might be wrong about that so try both and
use whichever you prefer.

On the other hand, the file route has the advantage that if you linked
to it (I have not actually tried this but maybe someone wants to figure
out how this works) rather than insert it (Word supports both linking
and embedding) then if the file changed your Word document automatically
would change too which would address the reproducibility comment that
someone on this thread had.




More information about the R-help mailing list