user-interface - R 脚本 : Determine whether the script is run in the GUI or from command line

标签 user-interface command-line r scripting

是否可以从脚本中确定脚本是在 R-GUI 中运行(特别是 OS X 上的 R.app)还是从终端/命令行调用(即 R --vanilla -f script.R )?如果是这样,这怎么可能?

我问是因为我有一个可以并行运行的脚本(使用 doMC 库),不应从 GUI 中使用。有时我需要进一步处理脚本中计算出的数据,所以我想在这些场合从 GUI 调用脚本。

最佳答案

也许您正在寻找 interactive() ?

关于user-interface - R 脚本 : Determine whether the script is run in the GUI or from command line,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2020790/

相关文章:

r - 在 R 中聚合时创建虚拟变量

r - 将三阶多项式及其方程添加到 r 中的 ggplot 中

java - 从 Controller 加载不同的 FXML 文件

java - 当图像路径更改时,JPanel 中的图像未更新

linux - Linux 上 Perl 单行代码中的单引号行为

command-line - 如何使用 zip cmd 工具将文件移动到未压缩的 zip

c++ - GUI 库 : How long should it take to write one from scratch?

java - Java 桌面应用程序中的 JFrame

linux - 如何验证两个 zip 包之间的等效性

python - 使用 R/python 和 SSD 进行数据分析