Evening all:
I'm taking a little time to experiment with R, Sweave, and Miktex/LaTex but
I've run up against some problems and -well- I hope that there are some on
the list who might have some suggestions. This will be kind of wordy as I
will include the complete files involved as I'm just not sure what I'm
looking for. Apologies at the outset.
I created the source file (example.Snw):
\documentclass[12pt,letterpaper]{article}
\title{Sweave Example 1}
\author{Friedrich Leisch}
\begin{document}
\maketitle
In this example we embed parts of the examples from the
\texttt{kruskal.test} help page into a \LaTeX{} document:
<<>>data(airquality)
library(stats)
kruskal.test(Ozone ~ Month , data=airquality)
@
which shows that the location parameter of the Ozone distribution varies
significantly from month to month. Finally we include a boxplot of the data:
\begin{center}
<<fig=TRUE , echo=FALSE>>boxplot(Ozone ~ Month , data=airquality)
@
\end{center}
\end{document}
which R seems to accept gracefully to produce the tex file (example.tex):
\documentclass[12pt,letterpaper]{article}
\title{Sweave Example 1}
\author{Friedrich Leisch}
\usepackage{C:/PROGRA~1/R/R-23~1.1/share/texmf/Sweave}
\begin{document}
\maketitle
In this example we embed parts of the examples from the
\texttt{kruskal.test} help page into a \LaTeX{} document:
\begin{Schunk}
\begin{Sinput}
> data(airquality)
> library(stats)
> kruskal.test(Ozone ~ Month, data = airquality)
\end{Sinput}
\begin{Soutput}
Kruskal-Wallis rank sum test
data: Ozone by Month
Kruskal-Wallis chi-squared = 29.2666, df = 4, p-value = 6.901e-06
\end{Soutput}
\end{Schunk}
which shows that the location parameter of the Ozone distribution varies
significantly from month to month. Finally we include a boxplot of the data:
\begin{center}
\includegraphics{example-002}
\end{center}
\end{document}
but when I try to run Latex on it I get errors (example.log):
This is e-TeX, Version 3.141592-2.2 (MiKTeX 2.4) (preloaded format=latex
2006.8.3) 3 AUG 2006 20:57
entering extended mode
**example.tex
(example.tex
LaTeX2e <2005/12/01>
Babel <v3.8g> and hyphenation patterns for english, usenglishmax,
dumylang, noh
yphenation, french, ukenglish, loaded.
(C:\texmf\tex\latex\base\article.cls
Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
(C:\texmf\tex\latex\base\size12.clo
File: size12.clo 2005/09/16 v1.4f Standard LaTeX file (size option)
)
\c at part=\count79
\c at section=\count80
\c at subsection=\count81
\c at subsubsection=\count82
\c at paragraph=\count83
\c at subparagraph=\count84
\c at figure=\count85
\c at table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
! Missing \endcsname inserted.
<to be read again>
\protect
l.5 \begin
{document}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.5 \begin
{document}
You're in trouble here. Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! Extra \endcsname.
\@onefilewithoptions ...\@currext -h@@k\endcsname
\@empty \let
\CurrentOptio...
l.5 \begin
{document}
I'm ignoring this, since I wasn't doing a \csname.
! Missing \endcsname inserted.
<to be read again>
\protect
l.5 \begin
{document}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Extra \endcsname.
\@ifl at aded ...er \ifx \csname ver@#2.#1\endcsname
\relax \expandafter
\@seco...
l.5 \begin
{document}
I'm ignoring this, since I wasn't doing a \csname.
! Missing \endcsname inserted.
<to be read again>
\protect
l.5 \begin
{document}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Extra \endcsname.
\@pass at ptions ...xdef \csname opt@#3.#1\endcsname
{\@ifundefined
{opt@#3.#1}...
l.5 \begin
{document}
I'm ignoring this, since I wasn't doing a \csname.
! Missing \endcsname inserted.
<to be read again>
\protect
l.5 \begin
{document}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Missing \endcsname inserted.
<to be read again>
\protect
l.5 \begin
{document}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Extra \endcsname.
<argument> ...e/texmf/Sweave.\@currext \endcsname
,
l.5 \begin
{document}
I'm ignoring this, since I wasn't doing a \csname.
! Missing \endcsname inserted.
<to be read again>
\protect
l.5 \begin
{document}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Extra \endcsname.
<argument> ...er@\@currname .\@currext \endcsname
\@empty
\InputIfFileExists...
l.5 \begin
{document}
I'm ignoring this, since I wasn't doing a \csname.
! LaTeX Error: File `C:/PROGRA\unhbox\voidb at x \penalty \@M \
{}1/R/R-23\unhbox\
voidb at x \penalty \@M \ {}1.1/share/texmf/Sweave.sty' not found.
Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)
Enter file name:
! Emergency stop.
<read *>
l.5 \begin
{document}
*** (cannot \read from terminal in nonstop modes)
Here is how much of TeX's memory you used:
207 strings out of 95856
1955 string characters out of 1194845
47360 words of memory out of 1051005
3348 multiletter control sequences out of 60000
3938 words of font info for 15 fonts, out of 1000000 for 2000
36 hyphenation exceptions out of 4999
22i,0n,19p,148b,36s stack positions out of 5000i,500n,10000p,200000b,32768s
No pages of output.
I have tried adding the appropriate R directory where sweave.sty exists
variously to the path in autoexec.bat and to the roots list in the options
program of Miktex. Neither seems to work. Does anybody out there who has
used sweave successfully have any advice on this situation?
Regards...
--
Brian Lunergan
Nepean, Ontario
Canada
---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0631-2, 2006-08-02
Tested on: 2006-08-03 21:21:05
avast! is copyright (c) 2000-2006 ALWIL Software.
http://www.avast.com