[R] Sweave from Kile

cls59 sharpsteen at mac.com
Mon Oct 13 16:16:36 CEST 2008


I use Sweave on a Mac from my LaTeX editor and it requires a similar shell
script to typeset the document. Mine uses R it's self (instead of sh) and
looks like:

 #!/usr/bin/Rscript
args <- commandArgs(T)
 
fname <- strsplit(args[1],'\\.')[[1]][1]
 
Sweave(paste(fname,'Rnw',sep='.'))

system(paste('pdflatex',paste(fname,'tex',sep='.')))


This script is run as so:

sweave /path/to/source.Rnw

It works pretty good, although I think I used: 

chmod 755 sweave

To make sure it would execute. You can also check ls -l to make sure you
have ownership of the file, if not you might need to hit it with chown.

-Charlie


Matthieu Stigler-2 wrote:
> 
> Hello
> 
> Does anybody have experience with Sweave run from Kile? I'm trying to 
> make it run but have problems and don't know if the instructions are 
> false or I do something wrong (my knowledge in bash and shell is too low 
> to understand it)...
> 
> I discovered recently Sweave and wanted to run it from my latex editor, 
> Kile. I found and followed these instructions:
>> If you want to be able to call Sweave outside of R, you will need to 
>> install a shell
>> script (see footnote 4). To install the script, copy it to 
>> /usr/local/bin, then open
>> the Konsole program and type sudo chmod +x /usr/local/bin/Sweave.sh to 
>> make it executable.
>> Next, you may want to tell Kile where to find the Sweave.sh shell 
>> script. Open
>> Kile and click Settings → Configure Kile. Click the Tools tab on the 
>> left-hand
>> side of the preferences window, and select Build. Click the New Tool 
>> button at the
>> bottom of the preferences window. Name the new tool Sweave, click 
>> next, and then
>> Finish. In the resulting screen, type Sweave.sh in the top box, and 
>> −ld \%source' in the
>> bottom box.
> I followed these instructions but have 2 problems:
> 1: finished with exit status 126
>> SweaveOnly output:
>> ***** cd '/media/Partition_Commune/Mes documents/Ordi/LaTex/Sweave'
>> ***** Sweave.sh −ld '\example1Leisch.Rnw'
>> *****
>> /bin/bash: /usr/local/bin/Sweave.sh: Permission non accordée
> in english: permission not given
> Do you see where the problem is?
> 
> 2: If I run kile with sudo (sudo Kile), the problem disappears but a new 
> one comes
>> SweaveOnly output:
>> ***** cd '/media/Partition_Commune/Mes documents/Ordi/LaTex/Sweave'
>> ***** Sweave.sh −ld '\example1Leisch.Rnw'
>> *****
>> Run Sweave and postprocess with LaTeX directly from command line
>> −ld is not a supported file type!
>> It should be one of: .lyx, .Rnw, .Snw., .nw or .tex
> Is the instructions false? Or do I do something wrong?
> 
> Thank you much for your help!!
> 
> ______________________________________________
> 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.
> 
> 


-----
Charlie Sharpsteen
Undergraduate
Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: http://www.nabble.com/Sweave-from-Kile-tp19955007p19955763.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list