[R] error possibly related to sweave, path, and spaces on windows

Juliet Hannah juliet.hannah at gmail.com
Sat Aug 21 18:02:37 CEST 2010


I have downloaded a file that I don't know how to describe correctly.
It contains R code and Latex, and I should be able to reproduce an
analysis by running an R script in this folder.

There is a line in the R script:

  junk <- system(paste("/usr/texbin/pdflatex ",latexFiles[i1]),
                 intern=TRUE)

that needs to be modified to run on my computer. I use WinEdt with
Miktek 2.6 Does anyone have any suggestions on how I can modify the
statement above to work on my computer. Or any other suggestions to
get it working.

On my computer I see that pdflatex.exe is in:

C:\Program Files\MiKTeX 2.6\miktex\bin

So I made the following modification.

junk <- system(paste("C:\\Program Files\\MiKTeX
2.6\\miktex\\bin\\pdflatex ",latexFiles[i1]),
                 intern=TRUE)

Maybe spaces are causing problems? Here is the error:

> source("D:\\My Documents\\Coombes2\\Scripts\\runAll2.R")
Writing to file buildRda.cellLinesFromPredictors.tex
Processing code chunks ...
 1 : echo term verbatim (label=options)
 2 : echo term verbatim (label=invokeMatchPredictors)
 3 : echo term verbatim (label=getLocation)
 4 : echo term verbatim (label=saveStuff)
 5 : echo term verbatim (label=sessionInfo)

You can now run LaTeX on 'buildRda.cellLinesFromPredictors.tex'
Error in system(paste("C:\\Program Files\\MiKTeX
2.6\\miktex\\bin\\pdflatex",  :
  C:\Program not found

Thanks for any help.

> sessionInfo()
R version 2.11.1 (2010-05-31)
i386-pc-mingw32

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base



More information about the R-help mailing list