[R] Sweave template

Frank E Harrell Jr f.harrell at vanderbilt.edu
Tue Jun 16 18:56:31 CEST 2009


Kevin W wrote:
> Frank,
> 
> Your template is very interesting.  The "pretty-ifing" of the left arrow 
> and tilde in the input chunk has the unfortunate side-effect of making 
> the code non-paste-able into R.

Kevin,

I haven't needed to do that.  It's best to make the .Rnw file available 
to others, or to tangle the file to isolate the R code.

> 
> I seem to recall that your reports used to include the latex source code 
> as an appendix.  Maybe one option could be to include an appendix with 

I only do that for stat computing presentations not for routine reports.

> the results of Stangle applied to the .Rnw file, formatted as plain 
> text.  This would create a concise collection of all the necessary code 
> to reproduce the results.

I'll probably go the separate file route using Stangle.
Frank

> 
> Just brainstorming here....
> 
> Kevin Wright
> 
> 
> On Sun, Jun 14, 2009 at 11:29 PM, Frank E Harrell Jr 
> <f.harrell at vanderbilt.edu <mailto:f.harrell at vanderbilt.edu>> wrote:
> 
>     Dear Group,
> 
>     I have made significant improvements to our Sweave template, have
>     made the template self-contained (i.e., you can run it yourself and
>     it will find the datasets it needs), and have included the output
>     pdf file. This is at http://biostat.mc.vanderbilt.edu/SweaveTemplate
>     .  You will see in the pdf file the enhancements in how R code is
>     pretty-printed, and I have added an example where some R function
>     output is suppressed from the listing that Sweave typesets.  The new
>     template also suggests how to auto-document the computing
>     environment at the end of the report, and how to properly reference
>     R and add-on packages.  Figures are centered (but not as nicely as
>     Marc Schwartz' approach) and better defaults are used for axis label
>     and tick mark label positioning.
> 
>     Thanks to Romain Francois for providing the trick of suppressing
>     parts of R output (replacing it with ...) and Peter Ruckdeschel for
>     his excellent SweaveListingUtils package.  Suggestions for further
>     improvements are welcomed.
> 
>     Frank
>     -- 
>     Frank E Harrell Jr   Professor and Chair           School of Medicine
>                         Department of Biostatistics   Vanderbilt University
> 
>     ______________________________________________
>     R-help at r-project.org <mailto:R-help at r-project.org> mailing list
>     https://stat.ethz.ch/mailman/listinfo/r-help
>     PLEASE do read the posting guide
>     http://www.R-project.org/posting-guide.html
>     and provide commented, minimal, self-contained, reproducible code.
> 
> 


-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University




More information about the R-help mailing list