且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在启动时加载 .Rprofile

更新时间:2023-12-05 16:45:22

R 文档应该有助于了解如何处理 .Rprofiles.在控制台执行以下操作:

The R docs should help to see how to deal with .Rprofiles. Execute the following at the console:

> ?Startup

这个的相关部分表示你需要将你的项目.Rprofile放在启动项目时将加载的初始工作目录中.因此,如果您的项目是 ~/foo/foobar.Rproj,那么您的配置文件应该是 ~/foo/.Rprofile 并确保在启动时,初始工作目录是 ~/foo/.您可以在 RStudio 控制台窗格顶部的标题栏中看到这一点.

The relevant portion of this indicates that you need to put your project .Rprofile in the initial working directory that will be loaded when starting the project. Thus if your project is ~/foo/foobar.Rproj, then you should have your profile be ~/foo/.Rprofile and make sure that when starting up, the initial working directory is ~/foo/. You can see this in the title bar at the top of the console pane in RStudio.

另外为了确认正确的 .Rprofile 确实被加载,我会亲自进行测试以查看哪个(如果有)配置文件被拾取.例如,包括:

Also to confirm that the correct .Rprofile is actually being loaded, I would personally put in a test to see which (if any) profile is being picked up. For example, include:

print("This is the Rprofile inside the foo project!")

这里是另一个关于让它工作的例子:

Here is another example about getting this to work:

http://support.rstudio.org/help/discussions/suggestions/1095-different-rprofile-for-a-project#comment_15690293

最后,如果在项目中加载了正确的 .Rprofile,那么您的代码一定有问题.看起来您是从我们的 docs 中获得的,所以如果您加载了配置文件,并且仍有问题,请告诉我们.您可以在我们的支持主题上发表新讨论.

Finally, if the correct .Rprofile is being loaded inside the project, then there must be something wrong with your code. Looks like you got this from our docs though, so if you get the profile loaded, and continue to have problems, please let us know. You can post a new discussion on our support thread.

乔希

产品经理 - RStudio

Product Manager - RStudio