[R] Problem compiling Rnw file

Jessica Streicher j.streicher at micromata.de
Mon Nov 5 17:58:35 CET 2012


I'll second the full path option.

Just create a variable path_to_data and concatenate it with the names of any files you need in that directory.
You could also try to use relative paths if the data is "nearby" and is likely to not change that position.

e.g. if the data was in '/home/r/Documents/mydata/whatever.txt', while you are working in '/home/r/Documents/myproj/', you can reach that directory via '../mydata/whatever.txt'.


On 05.11.2012, at 16:23, Riccardo Romoli wrote:

> Dear R list,
> I'm using R 2.15.2 with TeX Live 2009 and ESS 12.09 . I have a R
> project in the '/home/r/Documents/myproj/', which is my working
> directory (where I have the .Rnw file). Inside the document I have
> several "setwd()" to collect the datasets I use.
> 
> After I compile from the terminal using "R CMD Sweave myproj.Rnw", I
> receive the error:
> 
> Error in driver$finish(drobj) :
>  the output file 'myproj.tex' has disappeared
> Calls: <Anonymous> -> do.call -> <Anonymous> -> <Anonymous>
> Execution halted
> 
> but the file "myproj.tex" is produced and if I compile it using
> "pdflatex myproj.tex" all works fine.
> 
> Googling I found a similar problem but that guy have problem also
> compiling the tex file. I found enteresting a comment: "Thou shall
> never setwd() inside a report! setwd() should always be kept out of a
> report [...]". This is what I found:
> http://stackoverflow.com/questions/12162092/r-sweave-output-error
> 
> Anyone knows why that happens?? Have you any idea about this kind of
> error?? How can I solve this problem without moving the files and the
> folders where I have the data sets??
> 
> Best
> Riccardo
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list