[ESS] Sweave and R 2.12.0 on Windows

Brian Diggs diggsb at ohsu.edu
Mon Oct 25 23:34:40 CEST 2010


I recently upgraded to R 2.12.0 and now I have a weird error when I try 
to Sweave a document using ESS.  I think it has to do with Windows 
paths.  Given the minimalist Rnw file:

\documentclass{article}

\begin{document}
<<>>=
1
@

\end{document}


in the directory H:/My Documents, when I use the M-n s (bound to 
ess-swv-weave), I get the following output in the R buffer:

 > local({..od <- getwd(); setwd("h:\\My Documents\\"); Sweave("h:\\My 
Documents\\test.Rnw"); setwd(..od) })
Writing to file test.tex
Processing code chunks ...
  1 : echo term verbatim

Error:  chunk 1
Error : '\M' is an unrecognized escape in character string starting "h:\M"


which I don't understand.  Certainly, nothing in chunk 1 is making 
(direct) use of the path to the file.  I suppose the problem is not with 
ESS directly, because

 > Sweave("h:\\My Documents\\test.Rnw")
Writing to file test.tex
Processing code chunks ...
  1 : echo term verbatim

Error:  chunk 1
Error : '\M' is an unrecognized escape in character string starting "h:\M"
 > Sweave("test.Rnw")
Writing to file test.tex
Processing code chunks ...
  1 : echo term verbatim

You can now run LaTeX on 'test.tex'


However, since ESS goes ahead and sets the working directory, why bother 
including the full directory path of the file?  I plan on asking about 
the general behavior of Sweave with window's paths on R-help, but 
thought a workaround here would at least get me past the problem.

 > sessionInfo()
R version 2.12.0 (2010-10-15)
Platform: i386-pc-mingw32/i386 (32-bit)

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

`ess-version' is a variable declared in Lisp.
   -- loaded from "ess-custom"

Value: "5.11"

`emacs-version' is a variable declared in Lisp.
   -- loaded from "c:\XEmacsBuild\xemacs-21.4.22\lisp\version.el"

Value: "21.4 (patch 22) \"Instant Classic\" XEmacs Lucid"

-- 
Brian S. Diggs, PhD
Senior Research Associate, Department of Surgery
Oregon Health & Science University



More information about the ESS-help mailing list