Re: [R] Troubleshooting sweave

2010-11-12 Thread Duncan Murdoch

On 11/11/2010 10:29 PM, sachinthaka.abeyward...@allianz.com.au wrote:

seems like the texi2dvi doesnt exist on R2.12.0 anymore?


It's in the tools package. (The tools package is for tools used in R 
like installing packages, showing help, etc.  The utils package contains 
tools meant for public use.  The fact that texi2dvi is in tools means 
that it serves the purposes R needs, but might not serve every user: 
but if it does serve your purpose, feel free to use it.)


Duncan Murdoch

__
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.


Re: [R] Troubleshooting sweave

2010-11-11 Thread Marc Schwartz
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.


Re: [R] Troubleshooting sweave

2010-11-11 Thread Brian Diggs

On 11/11/2010 3: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'


That error message indicates that you attempted to load a package 
('ctest') that is not installed.  Normally, you would just need to 
install the package using the install.package() command. However, there 
is (no longer) a ctest package to install.  Digging through the email 
archives, it appears to have been merged into the stats package back in 
version 1.9.0.  So you can just delete the library(ctest) line in the 
Rnw file.


You can search for examples that are more recent; this one must have 
been from before April 2004 (when R 1.9.0 was released).  Though I don't 
blame you for being confused; I would also have expected the examples on 
what seems to be the canonical homepage to work and not be out-of-date.



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?


Check out the texi2dvi() function in the tools package.  If you want a 
PDF, be sure to use the pdf option.



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}


--
Brian S. Diggs, PhD
Senior Research Associate, Department of Surgery
Oregon Health  Science University

__
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.


Re: [R] Troubleshooting sweave

2010-11-11 Thread Duncan Murdoch

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?


The patchDVI package on R-forge includes functions to process (possibly 
multiple) Sweave inputs into .pdf or .dvi files.


E.g.

SweavePDF(Example.Rnw)


Duncan Murdoch



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}

--- Please consider the environment before printing this email --- 


Allianz - Best General Insurance Company of the Year 2010*
Allianz - General Insurance Company of the Year 2009+ 


* Australian Banking and Finance Insurance Awards
+ Australia and New Zealand Insurance Industry Awards 


This email and any attachments has been sent by Allianz Australia Insurance 
Limited (ABN 15 000 122 850) and is intended solely for the addressee. It is 
confidential, may contain personal information and may be subject to legal 
professional privilege. Unauthorised use is strictly prohibited and may be 
unlawful. If you have received this by mistake, confidentiality and any legal 
privilege are not waived or lost and we ask that you contact the sender and 
delete and destroy this and any other copies. In relation to any legal use you 
may make of the contents of this email, you must ensure that you comply with 
the Privacy Act (Cth) 1988 and you should note that the contents may be subject 
to copyright and therefore may not be reproduced, communicated or adapted 
without the express consent of the owner of the copyright.
Allianz will not be liable in connection with any data corruption, 
interruption, delay, computer virus or unauthorised access or amendment to the 
contents of this email. If this email is a commercial electronic message and 
you would prefer not to receive further commercial electronic messages from 
Allianz, please forward a copy of this email to unsubscr...@allianz.com.au with 
the word unsubscribe in the subject header.

__
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.


__
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.


Re: [R] Troubleshooting sweave

2010-11-11 Thread sachinthaka . abeywardana
seems like the texi2dvi doesnt exist on R2.12.0 anymore?

Sachin
p.s. sorry about corporate notice

--- Please consider the environment before printing this email --- 

Allianz - Best General Insurance Company of the Year 2010*
Allianz - General Insurance Company of the Year 2009+ 

* Australian Banking and Finance Insurance Awards
+ Australia and New Zealand Insurance Industry Awards 

This email and any attachments has been sent by Allianz Australia Insurance 
Limited (ABN 15 000 122 850) and is intended solely for the addressee. It is 
confidential, may contain personal information and may be subject to legal 
professional privilege. Unauthorised use is strictly prohibited and may be 
unlawful. If you have received this by mistake, confidentiality and any legal 
privilege are not waived or lost and we ask that you contact the sender and 
delete and destroy this and any other copies. In relation to any legal use you 
may make of the contents of this email, you must ensure that you comply with 
the Privacy Act (Cth) 1988 and you should note that the contents may be subject 
to copyright and therefore may not be reproduced, communicated or adapted 
without the express consent of the owner of the copyright.
Allianz will not be liable in connection with any data corruption, 
interruption, delay, computer virus or unauthorised access or amendment to the 
contents of this email. If this email is a commercial electronic message and 
you would prefer not to receive further commercial electronic messages from 
Allianz, please forward a copy of this email to unsubscr...@allianz.com.au with 
the word unsubscribe in the subject header.

__
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.