Incorporating bash scripts into an R package?

Background

I am writing an R package to support reproducible research. At this point, the workflow is mostly held together by bash scripts, and I can run an analysis by sending a single command like ./runscript.sh. I use bash for the following:

  1. file manipulation tar, rsync, 'rename'
  2. running bash files locally and via ssh
  3. running R scripts using R --vanilla that in turn call R functions
  4. find and replace text within files using sed
  5. submitting jobs via qsub

It seems to me that it would be much more efficient (cleaner and easier) to execute the entire workflow from an R function or R script. I am partial to R since I am more familiar with it and mostly work within emacs ESS.

Questions

  1. Would it be worthwhile to encapsulate all of these uses of bash within R using the system and files functions?

  2. Are there other R packages that I have not yet found that would be helpful for doing this?

Notes

Following Al3xa's answer, I realize that it is important to note that the speed penalty of using eg. R vs bash versions of tar and gsub on 1000-2000 files would likely be less than the current rate limiting steps in the workflow: computations by JAGS (~10-20min) and FORTRAN (>4hrs)

6
задан David LeBauer 23 February 2011 в 19:41
поделиться