Can't call cygwin commands from R

こ雲淡風輕ζ 提交于 2019-12-30 07:48:00

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/5068264/cant-call-cygwin-commands-from-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!