[R] Sweave

R Heberto Ghezzo, Dr heberto.ghezzo at mcgill.ca
Fri Feb 12 17:18:31 CET 2010


Hello, I am trying to start using Sweave. I copy the example from help Sweave

testfile <- system.file("Sweave", "Sweave-test-1.Rnw", package = "utils")
     ## enforce par(ask=FALSE)
options(device.ask.default=FALSE)
     ## create a LaTeX file
Sweave(testfile)
     ## This can be compiled to PDF by
tools::texi2dvi("Sweave-test-1.tex", pdf=TRUE)
 
and I get:

> Sweave(testfile)
Writing to file Sweave-test-1.tex
Processing code chunks ...
 1 : print term verbatim
 2 : term hide
 3 : echo print term verbatim
 4 : term verbatim
 5 : echo term verbatim
 6 : echo term verbatim eps pdf
 7 : echo term verbatim eps pdf
You can now run LaTeX on 'Sweave-test-1.tex'

> tools::texi2dvi("Sweave-test-1.tex", pdf=TRUE)
texify: -interaction=nonstopmode: unknown option
Error in tools::texi2dvi("Sweave-test-1.tex", pdf = TRUE) :
  unable to run E:\PortableUSB/PortableApps/MikeTex/miktex/bin/texi2dvi.exe on 'Sweave-test-1.tex'
>
I  installed Portable MikeTex in E:/PortableUSB/PortableApps/MikeText
I modified Rprofile.site with
 
.First <- function() {
 Sys.setenv("JAGS_HOME"=replace.substring.wild(R.home(), "R-*", "JAGS-1.0.3"))
Sys.setenv("LATEX"=replace.substring.wild(R.home(),"R*","PortableUSB/PortableApps/MikeTex/miktex/bin/latex.exe"))
Sys.setenv("PDFLATEX"=replace.substring.wild(R.home(),"R*","PortableUSB/PortableApps/MikeTex/miktex/bin/texi2dvi.exe"))
 }

Can somebody tell me what other environmental variables to add? or what I am doing wrong?
Thanks
Heberto Ghezzo 
McGill University
Montreal - Canada


More information about the R-help mailing list