简体   繁体   English

从活动的R会话重新加载.Renviron或.Rprofile(不重启R)?

[英]Reload .Renviron or .Rprofile from an active R session (without restarting R)?

When R starts (with default options), it loads the .Rprofile and .Renviron files in the working directory or user's home directory. 当R启动时(使用默认选项),它会在工作目录或用户的主目录中加载.Rprofile.Renviron文件。 In my case these files may be changed during the course of the R session (eg as packrat does). 在我的情况下,这些文件可能在R会话期间被更改(例如,像packrat那样)。 I was wondering if there is a way to ask R to simply refresh its .Renviron having to quit and restart R? 我想知道是否有办法要求R简单刷新它的.Renviron必须退出并重新启动R?

For instance, in the case of .Rprofile , it is sufficient to simply source(".Rprofile") to reload the .Rprofile from the working directory. 例如,在.Rprofile的情况下,只需简单地source(".Rprofile") .Rprofile source(".Rprofile")从工作目录重新加载.Rprofile就足够了。 Can something similar be managed for .Renviron ? 可以为.Renviron管理类似的东西吗?

Use readRenviron Reference: http://stat.ethz.ch/R-manual/R-devel/library/base/html/readRenviron.html 使用readRenviron参考: httpreadRenviron

Yes I remember getting stuck on Sys.getenv a while ago. 是的,我记得刚才被Sys.getenv困住了。 and thanks to your question, it reminded me about packrat. 并且由于你的问题,它让我想起了包装。 Going to use it to distribute some code for a manuscript. 打算用它来分发手稿的一些代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM