开发者

Can't call cygwin commands from R

开发者 https://www.devze.com 2023-02-12 04:18 出处:网络
I\'m working in windows box, and using cygwin to imitate unix 开发者_Go百科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

I'm working in windows box, and using cygwin to imitate unix 开发者_Go百科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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消