This might turn out to be a rather trivial question, but has me baffled for quite some time now. It all started when I installed the universal document converter pandoc
and added it to my path. So when I do echo $PATH
on the default terminal on my Mac OS X, it shows pandoc
and I am able to execute it.
However, when I tried invoking the same in an R session using system(pandoc --version)
, it could not recognize pandoc
. Further checking revealed that system('echo $PATH')
does not return the same path that I got on the terminal.
Can anyone help me with what is going on? I like to do all my work on RStudio
, and hence would prefer if I can use pandoc
directly from within. Hence the need to figure this out.
R and bash ( and undoubtedly Rstudio) each create separate environments. The Terminal.app starts a bash session with its own default PATH settings. When Simon Urbanek recently answered this question, he referred the questioner to the R-Mac-FAQ 12.19. His full response is in the R-SIG-MAC archives. On my mail client it appears with a subject line Re: [R-SIG-Mac] PATH and is dated January 30, 2012. He also referred the questioner to: http://developer.apple.com/library/mac/#qa/qa1067/_index.html
As ?EnvVar
tells you: "Sys.getenv
and Sys.setenv
to read and set environmental variables in an R session." But then you already seem to be aware of those functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With