[R] system command to a specific shell (bash)

Justin Haynes
Mon, 16 Apr 2012 17:06:14 -0000

I need to run a bash command, but when you call system() the default shell
is sh (see my sessionInfo below).
I found the shell command (
http://www.stat.ucl.ac.be/ISdidactique/Rhelp/library/base/html/shell.html)
but it seems to be disappeared in current versions of R?
I am running all this from R CMD BATCH  with "system" calls to other R
scripts.

For a little more info, I'm generating sphinx documents (a python
documentation library) through R and need to use a python virtual
environment.
So I need to call system('source bin/activate'), but "source"
isn't a
recognized command in the sh shell...


Any help is appreciated,

Justin

> sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=C
          LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] graphics  grDevices utils     datasets  stats     grid      methods
base

other attached packages:
[1] ggplot2_0.9.0  reshape2_1.2.1 plyr_1.7.1

loaded via a namespace (and not attached):
 [1] colorspace_1.1-1   dichromat_1.2-4    digest_0.5.1       MASS_7.3-16
     memoise_0.1        munsell_0.3
 [7] proto_0.3-9.2      RColorBrewer_1.0-5 scales_0.2.0       stringr_0.6
     tools_2.15.0

	[[alternative HTML version deleted]]