如何实现这个解决方案使R脚本交互?

问题描述:

我发现这个答案,我以前在这里讨论一个问题:How to get dialog/message box working in executable R file如何实现这个解决方案使R脚本交互?

答案就在这里: https://thesquareplanet.com/blog/interactive-r-scripts/

具体该位:

We can use this to provide an interactive R script executor in /usr/local/bin/Rint: #!/bin/sh f=$1; shift; env "R_PROFILE_USER=$f" "[email protected]" R --no-save -q 

我的问题是,我什么都不知道关于命令提示符或批处理文件。那么这行代表什么意思,我只是将它粘贴到命令提示符中,然后将“#!/ usr/local/bin/Rint”添加到我的可执行R脚本的顶部?

此行不适用于Windows cmd.exe外壳程序。这是针对UNIX/Linux shell的。

我们可以用它来提供在/ usr/local/bin目录/ RINT的互动[R脚本执行:

#!/bin/sh 
f=$1; 
shift; 
env "R_PROFILE_USER=$f" "[email protected]" 
R --no-save -q 
+0

谢谢,我接受了你的回答。你知道在Windows 10上有没有办法做到这一点? – user5720052

+0

我不知道R是否足以知道这是否可以在Windows上完成。我将删除'cmd'和'windows'标签并添加'shell'标签。 – lit

对于任何人还在找,这是最好的资源,我可以找到可执行[R图形用户界面中Windows系统:

http://oddhypothesis.blogspot.com.au/2014/04/deploying-self-contained-r-apps-to.html

仍然可以通过本教程,如果它回答了这个问题会更新。