[R] Sweave: conflict between setwd and \SweaveOpts{prefix.string=}

Matthieu Stigler matthieu.stigler at gmail.com
Tue Jan 20 12:53:18 CET 2009


Hello

I think there is a conflict between setwd() and 
\SweaveOpts{prefix.string=}. In the same document, those both command 
get Sweave confuse the files and directories. See:

say my .Rnw document is in File1

If one inserts some setwd() for another file:
-setwd(File2)

then the command \SweaveOpts{prefix.string=graphics/Rplots} will search 
the "graphics" folder in File2 because of command setwd(File2) and not 
in File1 where the .Rnw file is and as is said in Sweave Manual A10.

Hence Latex get really confused and does not work anymore: the command 
\includegraphics looks for folder "graphics" in the usual File1 but 
those can have been stored in File2.

I tried to add some:
\usepackage{graphicx}
\graphicspath{{../File2/graphics/}}
but resulot was not so convincing

Is there anyway to avoid this? Thanks!




More information about the R-help mailing list