Mihran Hovsepyan
Mihran Hovsepyan

Reputation: 11098

Can't call cygwin commands from R

I'm working in windows box, and using cygwin to imitate unix shell. Also I have R and want to run any system comand from it. I believe that system('command') would do this, but it didn't work for each 'command'. For example system('ls') returns /cygdrive/c/cygwin/bin/ls: write error: Bad file descriptor and I think that this is beacause R calls ls >& - which also returns same error. So how solve this problem?

Upvotes: 0

Views: 2207

Answers (1)

user346034
user346034

Reputation:

I hope you are still interested in a solution. Here is what I have:

  • Start R from Windows and call cygwin executable by path: system('C:/cygwin/bin/ls.exe');
  • Start R from within cygwin:
    • Start cygwin
    • Set path: export PATH="$PATH:/cygdrive/c/Programme/R-2.9.2/bin"
    • Call R: Rgui.exe
    • Call shell: system('ls')

Regards,

Martin.

Upvotes: 2

Related Questions