[R] latex
Patrick Hausmann
patrick.hausmann at uni-bremen.de
Wed Jul 3 19:51:59 CEST 2002
Hi Christian,
unfortunalty I can't help you with your problem (but I see
Mr. Harrell has send an answer).
Maybe you are interested in another solution how
to combine Latex and R (using "Sweave"[1]).
1. You need the library "tools" from CRAN
2. Save the next lines as 'c:\beispiel.rnw'
% ---- beispiel.rnw ----------
\documentclass{article}
\usepackage{graphicx}
\begin{document}
% ------ R-Code - Berechnung XYZ -------
<<Kap1,echo=T>>=
setwd("c:/")
library(hmisc)
a <- c(3,4,5,6,7,6,5,4,3,6)
b <- c(6,5,4,5,6,7,8,6,5,5)
mean.a <- mean(a)
da <- density(a)
db <- density(b)
@
% ------ R-Code - Berechnung XYZ -------
The mean of a is \Sexpr{mean.a}.
The kernel density from a and b:
\setkeys{Gin}{width=0.6\textwidth}
\begin{center}
<<pl1,fig=T,echo=F>>=
plot(da, xlim=range(da$x, db$x), ylim=range(da$y,
db$y),main="XYZ")
lines(db, col="red")
@
\end{center}
\begin{center}
<<tab1,echo=F>>=
summary.stats <- cbind(
'Mean (b)'=mean(b),
'SD (a)'=sd(a))
latex(summary.stats, fi='table.tex')
@
\input{table}
\end{center}
\end{document}
% ---- beispiel.rnw ----------
3. Start R
4. R> library(tools)
5. R> Sweave("C:/beispiel.rnw")
6. Now you can "latexen" the file 'beispiel.tex'
Regards Patrick
[1] See:
http://www.ci.tuwien.ac.at/~leisch/Sweave/Sweave-manual-20020507.pdf
[2] There is a new LaTeX-package called 'ctable'.
Purpose: "The 'ctable' package lets you easily typeset centered, captioned table and
figures floats with optional footnotes [...]." Maybe you take a look.
-------------
Patrick Hausmann
Friedrich-Wilhelm Str. 37 - D-28199 Bremen
Tel. +49 421 5980631 - Fax. +49 421 5980632
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list