\usepackage{tabularx}
\usepackage{listings}
\usepackage{graphicx}
\usepackage{url}
\usepackage{cite}
$ R CMD Sweave foo.Rnw ; texi2pdf foo.tex
http://www.stat.umn.edu/~charlie/Sweave/
http://www.stat.umn.edu/~charlie/Sweave/foo.pdf
http://www.stat.umn.edu/~charlie/Sweave/foo.Rnw
\pagebreak[3]
\verb@Sweave@
\begin{verbatim}
latex foo
\end{verbatim}
Figure~\ref{fig:one} (p.~\pageref{fig:one})
<
\begin{figure}
\begin{center}
<
<
n <- 50
x <- seq(1, n)
a.true <- 3
b.true <- 1.5
y.true <- a.true + b.true * x
s.true <- 17.3
y <- y.true + s.true * rnorm(n)
out1 <- lm(y ~ x)
summary(out1)
@
the base package: lattice commands return an object of class "trellis", the actual plotting is
performed by the print method for the class. Encapsulating calls to lattice functions in print()
statements should do the trick, e.g.:
<
library(lattice)
print(bwplot(1:10))
@
- if you rename your '.Rnw' to '.tex' as a work around, it plays nicely with the editors
- then once all formatting is done, copy '.tex' to '.Rnw' and run the command
- or just create a tex symlink to Rnw! ln -s mydoc.Rnw mydoc.tex
R CMD Sweave mydoc.Rnw && texi2pdf mydoc.tex && evince mydoc.pdf
In R, call
> Stangle(file='foo.Rnw')
to extract the R code, WARNING: this will overwrite 'foo.R'!!!!!
No comments:
Post a Comment