[R] Sweave absolute path versus relative path

Duncan Murdoch murdoch.duncan at gmail.com
Sat Oct 29 11:14:47 CEST 2011


On 11-10-29 1:58 AM, Trevor Davies wrote:
> Sorry, I should have really started a new thread with this because really it
> is a new question only loosely related to the first Q.
> Thanks for the assist.

I haven't looked at the Sweave sources, so I don't know why a relative 
path is needed, but I think you can probably use the LaTeX \input 
command (or possibly \include, but it sounds as though \input is better) 
rather than SweaveInput.  You would use SweaveInput if the file includes 
markup that needs to be processed by Sweave.  If it's just some .tex to 
include, let LaTeX do it.

Duncan Murdoch
>
> As  suggested I switched over to sweave.  I have a lot of .tex tables that I
>> have already created that I was previously inserting into my tex document
>> (using \input).  The journal I plan on submitting to eventually wants the
>> final .tex file so I thought it would be a good idea to use Sweave, it makes
>> a tex doc with my tables generated and it should be all good.
>>
>> I just spend a few hours trying to get the \SweaveInput commant to work
>> properly.  I finally determined that I couldn't put the file in as an
>> absolute path but it had to be a relative path.  I.e
>>
>> \SweaveInput{/home/tdavies/Dropbox/CollapseRecovery_Shared/trevor/afterAFS/writing/sweave/blah.tex}
>> gave the error:
>>
>> R CMD Sweave hitmiss.Rnw
>> Error in SweaveReadFile(c(ifile, file), syntax, encoding = encoding) :
>>    no Sweave file with name
>> './/home/tdavies/Dropbox/CollapseRecovery_Shared/trevor/afterAFS/writing/sweave/blah.tex'
>> found
>> Calls:<Anonymous>  ->  Sweave ->  SweaveReadFile ->  SweaveReadFile
>> Execution halted
>> make: *** [hitmiss.tex] Error 1
>>
>> However, when i use:
>>
>> \SweaveInput{../../../../../../../../home/tdavies/Dropbox/CollapseRecovery_Shared/trevor/afterAFS/writing/sweave/blah.tex}
>> It works fine.
>>
>> What am I missing here?
>> Thanks.
>>
>>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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