greport Package: Graphical Reporting for Clinical Trials
Viewing Reports
You must use Adobe Acrobat Reader to view
pdf
files generated by
greport
otherwise pop-ups will not work. Neither pop-ups nor hyperlinks will work if you view documents in a Web browser window. It is recommended that you click on
View ... Page Display ... Single Page
for optimum jumping between hyperlinks, i.e., do not use
Single Page Continuous
mode.
Example Reports
-
test.pdf
was generated with LaTeX variable poptype
set to 1 to use the LaTeX ocgtools
package for pop-up tooltips
-
report.pdf
was generated using poptype
3 to not use pop-ups but instead to show numbers of analyzed observations as tiny tables in figure captions. This method is more compatible with Mac.
- test.Rnw demonstrates more categorical data
- report.Rnw contains many longitudinal displays of continuous data, and has the philosophy of the package and software setup instructions including how to annotate variables with
labels
and units
for pretty output
- Resulting
pdf
reports are test.pdf and report.pdf
- Get ssafety.rda, the data file for
report.Rnw
Configuring Project Directory
Under your project directory where
knitr
files are stored, created subdirectories
gentex
(to hold LaTeX code generated by
greport
) and
pdf
(to hold generated graphics). You can use the
setgreportOption
function to name different directories, if you choose.
Special Installation Instructions
Configuring LaTeX
- After installing the
greport
package, run the following command in R: system.file('greport.sty', package='greport') to find greport.sty
. Copy this file to your LaTeX package tree. The most convenient location, which doesn't require running mktexlsr
to update the LaTeX system, is in your home directory under texmf/tex
.
- If using poptype=1, install LaTeX packages
ocgtools
- If using poptype=2, install tooltip.sty
- Install LaTeX package
relsize
- To download install LaTeX packages in Linux, you can obtain
bash
scripts getlatex
and getlatexfrom
from DocProcess and run
getlatex ocgtools
The LaTeX
chngpage
package is used by the
exReport
function to allow wide tables to go into the left margin for proper centering within the physical page.
Special Setup Instructions for Windows
- Install the most up-to-date version of Miktex, knitr, Hmisc, and R
- Use the Miktex package manager to install listings, ocg-p, ocgtools, relsize if not already installed
- Check the latex directory by searching for article.sty on your system and verify that ocgtools has been installed.
- You can ignore
ocgtools
if using poptype
3
- After installing these packages start the Miktex administration application (this is separate from the package installer). It has a button to update package list.
- Within the directory where test is located, create the gentex and pdf directories within the folder.
- Knit the test.rnw file.
- Open test.tex in pdflatex and compile it 3x.
- While running pdflatex may prompt to install additional latex packages that are not currently installed on your system.
The next release of the package will include the file
feh.bib
in the top level of where
greport
is installed on your system. Copy that file to the temporary directory where you copy
report.Rnw
so that
pdflatex
can find the bibliographic database.
Configuring R
test.Rnw
and
report.Rnw
use the
Hmisc
knitrSet
function to use features of
knitr
for pretty-printing of R code and other things.
Miscellaneous LaTeX Notes
- The LaTeX
spaper
package simplifies setup for statistical reports and papers - see BiostatisticianResponsibilities
-
spaper
uses the fancyhdr
package for running left (subsection) and right (section) headers. When a section or subsection heading is too long to fit in the space you have at least two recourses:
- Use
\fancyheadoffset{0.5in}
to allow headings to go 0.5in into margins
- Break up headings with line breaks. If you don't mind line breaks appearing in the Table of Contents, you can omit the brackets below and keep only the braces and their text. Note the use of
\\
to force a new line.
\subsection[This is a Section Heading That is Fairly Long]{This is a Section Heading\\That is Fairly Long}
- To create hyperlinks in the final
pdf
report use
\usepackage{hyperref}
\hypersetup{
bookmarks=false,
colorlinks=true, % false: boxed links; true: colored links
linkcolor=blue % color of internal links
}