[R] R2wd: Insert MS Word field

Michael Bach phaebz at gmail.com
Mon Apr 2 11:52:45 CEST 2012


Hello Everyone,

the basic idea is to generate an initial (MS Word) report by R (plots,
tables and outline structure), pass this document around so everyone
can add / change content (except plots and tables) and later to be
able to update the R plot / table logic and update the already
modified word file.

I was toying around with the R2wd [1] package to test whether it is a
viable way of writing the initial report from within R. Again, the
idea is to generate a template from R with R2wd, and distribute that
document to our co-students. They can then edit this file, i.e. add
text, captions etc., but the tables and plots should be reproducible
from within Word with the SWord [2] package.

Now R2wd and SWord have some nice features and already work, but for
the task described above a little bit is missing: SWord expects
(noweb-like) code snippets to be in a Word `field'. So as the subject
states, I need a way of inserting this word field from R2wd -
something along the lines of:

> wdField("<<results = hide, fig = TRUE>>= plot(1:100)")

sadly, I did not find that in the documentation. Any ideas or hints?

Best Regards,
Michael Bach

[1] http://cran.r-project.org/web/packages/R2wd/index.html
[2] http://cran.r-project.org/web/packages/SWordInstaller/index.html



More information about the R-help mailing list