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.

Note

Due to recent changes on Mac, pop-ups may no longer work when viewing pdf files. To be safe and to avoid having to install any of the LaTeX packages listed below, have pop-ups appear as small static images on each page by setting poptype to 3.

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 safety.rda, the data file for report.Rnw

Producing Closed Reports With Masked Data

For the purpose of running a closed report in which certain elements such as outcomes and lab data that are stratified by treatment are to be seen by non-DMC members just for the purpose of providing feedback on the format and type of content included in the report, the greport package has a function maskVal for masking the values of key variables. Each special variable is replaced with a variable having the same characteristics (0/1, logical, factor levels, range for numeric variables) and (by default) the same expected fraction of missing values. For logical and 0/1 binary variables the prevalence of the simulated values is 0.5 by default. Numeric variables have the same range as the real data but have a uniform distribution over that range and are rounded so as to have the same resolution as the raw data. The greport function maskDframe runs maskVal on a user-specified set of variables. The following example shows how to create a master list of variables to be perturbed, and then perturbing the correct variables in two different data frames. factor variables are replaced by a sample from a multinomial distribution with equal cell probabilities using the original levels. maskdata <- TRUE # set to FALSE for real run if(maskdata) { # Data frame d1 has death and heart.failure and many other variables # d2 has ckmb plus more f <- ~ death + heart.failure + ckmb d1 <- maskDframe(d1, f) d2 <- maskDframe(d2, f) } or use if(maskdata) { d1 <- maskDframe(d1, ~ death + heart.failure) d2 <- maskDframe(d2, ~ ckmb) } If maskdata is set early in the program, you can have code like the following to add a note to the title page. \Sexpr{if(maskdata) '\\textbf{\\Large SAMPLE OUTPUT USING MASKED DATA}\n'} # or: \Sexpr{if(maskdata) '\\marginpar{\color{red}Sample output using masked data}\n'}

It is not recommended to perturb the treatment assignment in place of the outcome variables, because stratification by a dummy treatment variable will result in estimates that can be pooled to estimate marginal event probabilities. Often the marginal event probabilities can unmask the treatment effect if there is prior information about event tendencies in a control group.

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

  1. 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.
  2. If using poptype=1, install LaTeX packages ocgtools
  3. If using poptype=2, install tooltip.sty
  4. Install LaTeX package relsize
  5. 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.

NEW 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:
    1. Use \fancyheadoffset{0.5in} to allow headings to go 0.5in into margins
    2. 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
}
Topic attachments
I Attachment Action Size Date Who CommentSorted descending
talk.pdfpdf talk.pdf manage 368.2 K 16 Mar 2015 - 09:22 FrankHarrell greport presentation slides
Topic revision: r25 - 04 Sep 2019, FrankHarrell
 

This site is powered by FoswikiCopyright © 2013-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki? Send feedback