[R] Combining Sweave and LaTeX-packages?

Frank E Harrell Jr f.harrell at vanderbilt.edu
Sun Dec 21 18:17:07 CET 2008


Oliver Bandel wrote:
> Hello,
> 
> a while ago I asked for collaboration support
> R <-> LaTeX.
> 
> I got some answers, and Sweave was one, to use
> the Hmisc package another one.
> 
> Both  have their advantages and drawbacks.
> 
> At the moment I would absolutely prefer Sweave,
> because the inclusion is done automatically, and I do not
> have to \include{myRTeXFile} by myself.
> 
> One (THE) drawback is, that the results of commands
> normally will be included as verbose text.
> This is ok for many applications, but when printing data-frames,
> this often looks unclear for the eye.
> 
> But Hmisc's latex() function(s) create always *.tex-files.
> Then I have to use the include-statement by myself and also
> my working directory will be filled up with *.tex files...

No, read the latex function's documentation more closely.  Specifying 
file='' will result in tex code appearing inline so results=tex will 
work fine with Sweave.

Frank

> 
> I just want to have the TeX-output to appear in the *.tex,
> that Sweave creates.
> 
> I found out, that Sweave can also be used in a way, that
> it interprets a code chunk as TeX-stuff, for example
> the output of a function can create LaTeX-stuff and then it
> will be used "as is" for TeXing (with option "results=tex").
> 
> This is fine.
> 
> I have written a simple function that does a simple table layout, but so
> far is not very flexible. It just prints a data-frame in LaTeX-syntax in
> a tabular environment, but alignment is fixed so far.
> 
> 
> Before I might invest more time to develop a more flexible
> set of functions (and then making a package out of it) I
> want to know, if there is already something like this, so I do not
> have to invent the already existing wheel again.
> 
> If there is such a package (or even more than one),
> which would you recommend?
> 
> If there is nothing for this application,
> what general rules would you give, for developing such a package,
> or a package in general? Should I use S4-OOP-style?
> 
> Ciao,
>    Oliver
> 
> ______________________________________________
> 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