[R] Help With Sweave:

M. Jankowski mjankowski at gmail.com
Wed Jun 20 06:36:41 CEST 2007


Dirk,

Your solution worked wonders! This is outstanding! Thank you!

Matt

On 6/19/07, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> Matt,
>
> On 19 June 2007 at 21:23, M. Jankowski wrote:
> | Hi All,
> |
> | I am running Ubuntu Feisty (7.04) on a Thinkpad T41. I've installed
> | the nowebm package for Ubuntu. Working from this HowTo:
> | http://www.ci.tuwien.ac.at/~leisch/Sweave/example-1.Snw
> | I try to compile the example *.Snw as in the Sweave manual:
> |
> | mdj at lapmdj:~/Desktop/Sweave/example1$ noweb example-1.Snw
> | Can't open output file
> |
> | Despite the error, a *.tex file is produced. Now I am stuck because I
> | cannot seem to get the CTAN noweb package correctly installed  for my
> | Latex installation. I guess I am somewhat spoiled by the Synaptic
> | package manager. Here is the result of my best attempt to get the
> | noweb package installed:
>
> i)   No external noweb package is needed
> ii)  Synaptic is not used to install CRAN / CTAN packages
> iii) Everything should be provided by r-base-core and tetex-extra.
>
> Since relatively recently, a 'Sweave' command has been added.  So simply do
>
>         $ R CMD Sweave example-1.Snw
>         $ pdflatex example-1.tex
>         $ kpdf example-1.pdf            # or xpdf, or gv, or ...
>
> | A bunch of errors. What am I doing wrong? Any help is much
> | appreciated!
>
> You simply make your life too complicated when Debian and Ubuntu make it
> easier for you :)
>
> | Of course, if there is a better place for me to ask this question
> | please let me know where! Thanks!
>
> The r-sig-debian list is appropriate for problems with Debian / Ubuntu.
>
> Dirk
>
> PS  I usually use simple shell wrappers like this one. Others prefer
> Makefile.
>
>
> edd at basebud:~> cat /home/edd/bin/sweave
> #!/bin/bash -e
>
> function errorexit () {
>     echo "Error: $1"
>     exit 1
> }
>
> function filetest () {
>     if [ ! -f $1 ]; then
>        errorexit "File $1 not found"
>     fi
>     return 0
> }
>
>
> if [ "$#" -lt 1 ]; then
>     errorexit "Need to specify argument file"
> fi
>
>
> BASENAME=$(basename $1 .Rnw)
>
> RNWFILE=$BASENAME.Rnw
> filetest $RNWFILE
> echo "library(tools); Sweave(\"$RNWFILE\")" \
>       | R --no-save --no-restore --slave
>
> LATEXFILE=$BASENAME.tex
> filetest $LATEXFILE && pdflatex $LATEXFILE
>
> PDFFILE=$BASENAME.pdf
> #filetest $PDFFILE && acroread $PDFFILE &
> #filetest $PDFFILE && xpdf $PDFFILE &
> filetest $PDFFILE && kpdf $PDFFILE &
>
>
> --
> Hell, there are no rules here - we're trying to accomplish something.
>                                                   -- Thomas A. Edison
>



More information about the R-help mailing list