[OS X TeX] R statistics package
Michael Kubovy
kubovy at virginia.edu
Thu Feb 22 01:42:49 CET 2007
Hi Enrico,
On Feb 21, 2007, at 1:26 PM, Salvatore Enrico Indiogine wrote:
> From some Googling I see that is is possible to integrate R and LaTeX.
> I tried an Sweave example but it does not work. I bet I have to
> install some R and/or LaTeX packages.
************ Create the .Rnw file ******************
Choose a working directory, e.g., in my case "/Users/mk/Documents/"
In that directory create a file called "try.Rnw":
******
\documentclass[]{article}
\usepackage{graphicx}
\title{Brief Article}
\author{The Author}
\begin{document}
\maketitle
Hello, Sweave!
<<plot, include = T, fig = T>>=
x <- 1:10
y <- x^2
plot(x, y)
@
\end{document}
******
************ Run Sweave() on the .Rnw file ******************
In R type
setwd('/Users/mk/Documents/')
Sweave('try.Rnw')
Now you will have "try.tex" in your directory together with two files
"try-plot.pdf" and "try-plot.eps"
************ Compile the .tex file ******************
Open try.tex and compile it.
************ RTFM ******************
http://www.ci.tuwien.ac.at/~leisch/Sweave/Sweave-manual-20060104.pdf
and perhaps
http://www.stat.psu.edu/~dhunter/R/html/utils/html/Sweave.html
The learning curve is shallow, but repays patience.
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400 Charlottesville, VA 22904-4400
Parcels: Room 102 Gilmer Hall
McCormick Road Charlottesville, VA 22903
Office: B011 +1-434-982-4729
Lab: B019 +1-434-982-4751
Fax: +1-434-982-4766
WWW: http://www.people.virginia.edu/~mk9y/
------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/
More information about the macostex-archives
mailing list