Re: [R] Help With Sweave:

From: Dirk Eddelbuettel <>
Date: Tue, 19 Jun 2007 21:44:06 -0500


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:
| 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.


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"
    return 0

if [ "$#" -lt 1 ]; then

    errorexit "Need to specify argument file" fi

BASENAME=$(basename $1 .Rnw)

filetest $RNWFILE
echo "library(tools); Sweave(\"$RNWFILE\")" \

      | R --no-save --no-restore --slave

filetest $LATEXFILE && pdflatex $LATEXFILE


#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

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 20 Jun 2007 - 02:49:46 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 20 Jun 2007 - 05:32:18 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.