Skip to content
Prev 246414 / 398503 Next

R command execution from shell

On Tue, 4 Jan 2011, Duncan Murdoch wrote:

            
It is marginally preferable to use Rscript in place of 'R --slave'.
I think in all known shells

Rscript -e "write('hello world', file = 'hello.txt')"

will work.  (If not, shQuote() will not work for that shell, but this 
does work in sh+clones, csh+clones, zsh and Windows' cmd.exe.)