How do I test if R is running as Rscript?

后端 未结 1 951
小鲜肉
小鲜肉 2021-01-11 17:20

I have code in a single R file that I want to be able to source (i.e., to define my functions etc.) within RStudio during development, and also run using the #! /usr/b

相关标签:
1条回答
  • 2021-01-11 17:56

    You could use interactive to test if R is running in interactive mode. interactive will return FALSE under Rscript and TRUE under (most?) GUIs.

    0 讨论(0)
提交回复
热议问题