[R] Paths for Shell Scripts called from R
damian.betebenner at bc.edu
Sat Dec 11 22:54:22 CET 2004
I suspect this is more a linux question than an R question, but I'll describe my situation in case
anyone here knows of an elegant solution.
I'm using Sweave and R to create thousands of customized reports. Within an R loop, I have R create
a table.tex file using the CAT function which, for each iteration, creates a unique table.tex file in
a subdirectory of the directory from which the master file is sourced. I have written a shell script called
latexall that pdflatexs all the files in a given directory. I want to call latexall from within R using the SYSTEM command after I've created all my table.tex files. Later, the .pdfs of these tables are read into the
document using the includegraphics command (The reason I'm creating tables this way is for
two reasons: 1. xtable and latextable are limited, especially when one is producing complicated tables
with \multicolumn headings and \raisebox commands that make the tables look nice; and 2. I've found
that precompiling tables and then inputing them into a .tex file using the \includegraphics command
takes much of the headache out of table production in LaTeX. In particular, tables that are too wide are
easily dealt with by changing the scale factor. Float placement also seems easier to me when using
My bash shell script uses a standard for loop to loop over all the .tex file in a directory
for f in *.tex
The problem that I'm having is that I can't seem to direct latexall to the correct subdirectory without placing
latexall in the subdirectory with all the table.tex files and hard coding that subdirectory into the the shell
script before using the SYSTEM command to call latexall.
for f in /home/directory/subdirectory/tables/*.tex
Does anyone have an idea of how I can pass the appropriate path to my shell script from within R?
I hope this makes sense.
Any help greatly appreciated.
Educational Research, Measurement & Evaluation
Lynch School of Education
Chestnut Hill, MA 02467
(617) 552 4491
More information about the R-help