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

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Tue Jan 20 13:30:42 CET 2009

Have you tried specifying an absolute path in prefix.string instead of a
relative one?



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be 

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org]
Namens Matthieu Stigler
Verzonden: dinsdag 20 januari 2009 12:53
Aan: r-help op r-project.org
Onderwerp: [R] Sweave: conflict between setwd and


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:

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:
but resulot was not so convincing

Is there anyway to avoid this? Thanks!

R-help op r-project.org mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.

More information about the R-help mailing list