Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有一个 R 文件,其中有一个函数 getInfo() 。我想单独在那个脚本文件中运行这个函数。那可能吗 ?我知道在文件上运行脚本命令然后运行函数名会有所帮助。但是它也会从我不想要的脚本文件中运行其余的东西。在这里最好的出路是什么
当您source在脚本文件上使用时,该文件中的所有代码都将加载到当前活动的 R 会话中。任何不在函数中的代码都将被执行。我看到两个选项:
source
option
getOption
我会选择选项1。