Rev 2 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#!/bin/sh##--- NEW: ----------#### Given a list of files of the form .../.../<name>.R,#### Produce one large file, i.e. write to stdout## 'cat'ting the files together with## 1) Putting a HEADER in front## 2) EDITing a few of the files## 3) appending a FOOTER ...## Should work WHEREVER this is called from :(cd `dirname $0`/..RHOME=`pwd`; export RHOME)RHOME=`cd ${RHOME}; pwd` # absoluteFILES="$@"#Dbg> echo "RHOME=$RHOME"; echo#Dbg> echo "FILES=$FILES"; echo ; echo; exit## 1) ---- Header ----echo "postscript('All-Examples.ps'); iter <- 0; eigenval <- 1e-12; .Random.seed <- 1:3"## 2) ---- edit a few of these files:for file in $FILESdobf=`basename $file .R`#Dbg: echo $bf >&2if [ $bf = 'on.exit' ]; then sed -e '$s/$/; par(opar)/' $fileelif [ $bf = 'pictex' ]; then sed -e '4,$s/^/##LaTex /' $fileelif [ $bf = 'postscript' ]; then sed -e '/^postscript(/s/^/## /' $fileelif [ $bf = 'Random' ]; then sed -e '$s/$/; .Random.seed <- 9:7/' $fileelif [ $bf = 'solve' ]; then sed -e '/error:.*singular/s/^/## /' $fileelif [ $bf = 'dataentry' ]; thensed -e '/^d[A-z.]*(/s/^/##INTERACTIVE> /' $fileelif [ $bf = 'edit' ]; thensed -e '/edit(/s/^/##INTERACTIVE> /; /^vi(/s/^/##INTERACTIVE> /' $fileelse cat $filefidone## 3) ---- Footer ----echo "dev.off(); quit('no')"