One of the main goals of analyzing clinical data is to produce a report. (What, you thought it was to make the world a better place?) The R Project has, of course, all the tools you need to perform the statistical analysis, calculate the tables of results, and present conclusions graphically. But how can you assemble all of that into a report that someone can, you know, read?
You could go the cut-and-paste route: write the text in Word, export the data from R to format the tables in Excel, dress up the saved charts in Photoshop. But that’s a complex, manual process, and manual processes can introduce errors. Worse yet, if the data ever changes, you’ve got to go through the whole process again to update the report. That means no interim reports, and conversely, a big barrier to correcting the data and the report after it’s published.
Vanderbilt Biostatistics professor Frank Harrell has a different solution: the rreport package for R. (See an overview slide deck here.) It’s designed to produce statistical reports for clinical trials, and is especially useful for producing interim reports for data monitoring committees (DMCs). You can use it to create a complete report document, fully automating the process of generating tables from your R analyses like this:
The rreport system is an example of literate programming: the tables and reports are interwoven into the narrative text in a single source document in the open-source LaTeX typesetting language, and the entire report can be redone, with all results recalculated and all charts regenerated from the source data, in a single step. Using LaTeX does take some getting used to — it’s not a WYSIWYG environment like Word — but does make for very attractive reports and the ability to easily typeset the Greek-laden mathematical equations so prevalent in clinical trial reports. You can download rreport from the Vanderbilt CVS repository at the link below.
Department of Biostatistics, Vanderbilt University: rreport package