Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R Sweave output error

Tags:

r

sweave

I'm using RStudio v0.96.331 with pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian). I have a R project in the '/home/operacao/Myprojs/projName', which is my working directory.

Now, if i create a folder called 'reports' in '/home/operacao/Myprojs/projName/reports', and inside the sweave file (which is in the reports folder) use the code

  setwd('/home/operacao/Myprojs/projName')

After loading some packages, i receive the error

 Error in driver$finish(drobj) : 
 the output file 'my_report.tex' has disappeared
 Calls: <Anonymous> -> <Anonymous>
 Execution halted

But the file is in the folder, and the plots i made appear in the .pdf. The text output does not appear.

Anyone knows why that happens? If i save the Sweave files in my directly in my working directory, everything works fine.

Thanks!

like image 358
Fernando Avatar asked Aug 28 '12 14:08

Fernando


Video Answer


1 Answers

Probably RStudio requires you to set the working directory to the location which contains the Sweave file. Why do you need to set your working directory to another directory? You could use source to load any R code files which are in projName.

like image 95
Paul Hiemstra Avatar answered Jan 01 '23 06:01

Paul Hiemstra