You are here:

STAT2WORD

15 September 2010

Teacher: Christian Ritter

Summary

Whether appropriate or not, many statisticians report their results in Microsoft Word documents. To a certain extent this is easy and convenient as it simply implies carrying out statistical analysis in whatever software and cutting and pasting the results into the report. The downside of this approach is report maintenance and automation: whenever data or elements of the analysis change, the report has to be rewritten. This is particularly annoying for monthly or quarterly reporting.

Recently, several tools have appeared which make it much easier to communicate directly between statistical software and Word and to automate analysis reporting. In this workshop, I shall visit a selection of such tools and give the participants the opportunity to experiment with them. Among the tools visited are SWORD, R2wd, the StatconnDCOMserver, xl2wd, and odfWeave.
SWORD is an add-in for Word which allows inserting and executing R code in Word documents in form of ‘Fields’. The marked up document can then be ‘run’ through R at which stage the fields are replaced by R output (text, tables, graphs), and the result is exported as a pure Word document.

R2wd goes the opposite direction. It allows writing Word documents from R. This can either concern entire documents or filling-in bookmarked places in templates.

Both, SWORD and R2wd use the StatconnDCOM interface. This interface facilitates interchange of statistical data and analysis output between Windows applications. This means that SWORD and R2wd are just examples of a larger family of possible combinations including other statistical applications and office programs.

xl2wd serves to write automatic Word documents from Excel. It only uses the inbuilt COM services in Microsoft Office to facilitate inserting Excel material (tables, charts, text) into Word. It can be used either as a collection of VBA statements similar to the ones used in R2wd or via a menu interface at the worksheet level. At the worksheet level there is a script recorder which allows writing a VBA procedure to automate the steps.

Finally, odfWeave is similar to SWORD but uses odf documents in OpenOffice Write. Since odf is an ‘open document format’, the resulting documents can easily be converted to Word.