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

Erik Iverson eriki at ccbr.umn.edu
Sat Aug 21 18:07:57 CEST 2010


On 08/21/2010 11:02 AM, Juliet Hannah wrote:
> 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.

Yes, see the first paragraph of the Details section of ?system.

You can also check your system path, I think MikTeX tries to
alter it to include its "bin" directory.  Therefore, you might
get by with just using "pdflatex" as your command in the system
call.



More information about the R-help mailing list