On Nov 11, 2010, at 5:42 PM, sachinthaka.abeyward...@allianz.com.au wrote:

> 
> Hi All,
> 
> I've reproduced the example from Prof. Friedrich Leisch's webpage. When I
> write sweave("Example-1.Snw") OR sweave("Example-1.Rnw"), (yes, I renamed
> them). I get the following error:
> 
> Writing to file example-1.tex
> Processing code chunks ...
> 1 : echo term verbatim
> 
> Error:  chunk 1
> Error in library(ctest) : there is no package called 'ctest'
> 
> Also while I'm at it, is there an R command to compile the tex file as a
> pdf or does the Sweave() function do that for me?
> 
> Thanks,
> Sachin
> p.s. sorry about the corporate notice.
> 
> example-1.Rnw: from http://www.statistik.lmu.de/~leisch/Sweave/
> 
> \documentclass[a4paper]{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(ctest)
> 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}


'ctest' was a package that was merged into the 'stats' package in R version 
1.9.0, which was released back in 2004. So it would appear that Fritz (cc'd 
here) has not updated the examples to reflect that change.

A simple fix would be to remove the 'library(ctest)' line from the file.

If you look at:

  require(utils)
  ?Sweave

there are some examples of using both internal and external R commands to 
process the file into a PDF. Sweave itself just generates the TeX source file 
(.tex), which then requires a LaTeX installation to process that file into the 
PDF (or EPS as may be required). 

I would also be sure to review ?RweaveLatex for more information, including 
some potential environment issues that you may have to address in the Details 
section. Fritz' Sweave FAQ and manual on his site are also good references as 
may be required.

Presuming that you have LaTeX installed on your computer, the easiest thing to 
do may to use:

  pdflatex YourFileName.tex

at the command line, to process the resultant TeX file into a PDF. The steps 
can be a bit more complicated if you are using any LaTeX packages that might 
require the intermediate creation of a DVI and PS file. That would include 
packages such as PSTricks, etc.

HTH,

Marc Schwartz

______________________________________________
R-help@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.

Reply via email to