[英]Rgui command-line for sourcing R file
What command line option to use behind Rgui.exe for immediately sourcing an R source file? 在Rgui.exe之后使用什么命令行选项立即采购R源文件? Instead of having to type
source("c:\\MyGreatSource.R")
manually afterwards. 之后不必手动键入
source("c:\\MyGreatSource.R")
。 Something like: 就像是:
Rgui.exe --source "c:\\MyGreatSource.R"
Rgui.exe-源“ c:\\ MyGreatSource.R”
Sounds like a simple question answered in any beginner's manual, but I couldn't find such an option anywhere. 听起来像是任何初学者手册中回答的简单问题,但我在任何地方都找不到这样的选择。
I found a workable solution, maybe others are interested. 我找到了可行的解决方案,也许其他人对此感兴趣。 Again, what I like to do is to start the Rgui and work there.
同样,我想做的是启动Rgui并在那里工作。 All my work environment and functions are defined in an R source file, which I constantly develop further during working.
我所有的工作环境和功能都在R源文件中定义,我在工作过程中不断对其进行进一步的开发。 So each of my commands in the GUI starts with Load1();
因此,我在GUI中的每个命令都以Load1()开头; where Load1 is a function which simply sources my R file, to update the changes I have just made.
其中Load1是仅提供我的R文件的功能,以更新我刚刚所做的更改。 Obviously, Load1 is also defined in my R file, so I need to get it in the first place, without much effort.
显然,Load1也已在我的R文件中定义,因此我需要一开始就毫不费力地获取它。 I have set the command-line options for neither loading nor saving the workplace;
我已经设置了既不加载也不保存工作场所的命令行选项; I don't like my old mess from the previous session with test variables and so.
我不喜欢上一个会话中带有测试变量等的旧内容。
However, my solution now is to just create a workplace RData file which only contains the definition of my Load1 function. 但是,我现在的解决方案是只创建一个工作区RData文件,其中仅包含我的Load1函数的定义。 This workplace file is easily loaded at every start by just adding its path into the command-line options
"D:\\MyLoad1.RData"
只需将其路径添加到命令行选项
"D:\\MyLoad1.RData"
,即可轻松在每次启动时加载此工作场所文件。
I use a AutoHotkey Script 我使用AutoHotkey脚本
run,C:\Program Files\R\R-3.3.3\bin\x64\Rgui.exe
WinWait,RGui (64-bit)
WinWaitActive,RGui (64-bit)
Sleep 100
Send,source("%1%")
Send,{enter}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.