Incorporating bash scripts into an R package? -
background
i writing r package support reproducible research. @ point, workflow held bash scripts, , can run analysis sending single command ./runscript.sh
. use bash following:
- file manipulation
tar
,rsync
, 'rename' - running bash files locally , via
ssh
- running r scripts using
r --vanilla
in turn call r functions - find , replace text within files using
sed
- submitting jobs via
qsub
it seems me more efficient (cleaner , easier) execute entire workflow r function or r script. partial r since more familiar , work within emacs ess.
questions
would worthwhile encapsulate of these uses of bash within r using
system
,files
functions?are there other r packages have not yet found helpful doing this?
notes
following al3xa's answer, realize important note speed penalty of using eg. r vs bash versions of tar , gsub on 1000-2000 files less current rate limiting steps in workflow: computations jags (~10-20min) , fortran (>4hrs)
i'm big fan of using r "integrated" environment vs. bash scripts. i'm in process of moving of bash , ruby scripts rscript need make changes them.
there couple of reasons not move r come mind. i'm referring using rscript accomplish this
1) speed, testing moderate impact in situation i've come across, , trivial relative times mentioned.
2) portability, in paths rscript, etc. may different across systems. i've had no problems writing things on os x , moving them linux server, might break on windows.
the advantages in book are:
1) easier me write. don't have switch , forth between slight idiosyncrasies things conditional statements , loops.
2) more forgiving. can't describe how time i've spent trying bash scripts work because accidentally had space shouldn't have. r nicer in regard (yes, of course, should follow conventions in r perfectly, i'd rather not stall me hours if don't).
3) better work. tar
file doesn't matter, find better text manipulation in r vs. awk/sed
example.
re: packages helpful -- doesn't exist, knowledge, i'd love version of make
that's based on r. make's syntax 1 of inflexible out there (tabs vs spaces? really?) - i'd love write r-based alternative. day, will...
Comments
Post a Comment