[英]How to dynamically change R .libPaths() based on hostname?
I have two virtual machines running two different versions of GNU/Linux and accessing the same R executable from the same user account. 我有两个运行两个不同版本的GNU / Linux的虚拟机,并从同一用户帐户访问同一R可执行文件。
I'd like to use different libraries depending on the operating system. 我想根据操作系统使用不同的库。 Right now I'm (un)commenting an
R_LIBS=
environment variable each time I switch systems. 现在,每次切换系统时,我都在(取消)注释
R_LIBS=
环境变量。 Is there a better way to do this? 有一个更好的方法吗?
I tried placing if-then logic in bash syntax based on uname -n
, but got the following warning: 我尝试根据
uname -n
将if-then逻辑放入bash语法中,但收到以下警告:
File /home/wdkrnls/.Renviron contains invalid line(s)
then
else
fi
They were ignored
I take it this file doesn't support programming constructs. 我认为该文件不支持编程构造。
Something like this? 像这样吗
machine_name <- Sys.info()['nodename']
if (machine_name == 'myMachine1') {
.libPaths(...)
} else {
.libPaths(...)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.