以下正确打印" hello world":
main_script.R
commandArgs <- function() "hello world"
source('file_to_source.R')
file_to_source.R
word<-(commandArgs())
print(word)
但是,如果main_script.R中的代码是从Shiny应用程序中运行的,则file_to_source.R将打印:
[1]&#34; RStudio&#34; &#34; - 交互式&#34;
有解决方法吗?我真的希望能够从闪亮的内部将变量传递给另一个脚本。