【问题标题】:Rprofile.site not found by R on Startup in macosR在macOS中的启动时找不到Rprofile.site
【发布时间】:2019-04-10 17:14:13
【问题描述】:

问题

R 无法检测到主目录的 /etc 文件夹中是否存在“Rprofile.site”文件。

调查

由于 Rprofile.site 以 /etc/Rprofile.site 的形式存在于主目录中。我使用R.home(component="home") 检查了主目录并得到了"/Library/Frameworks/R.framework/Resources"。然后我在 RStudio 中创建了一个 Rprofile.site 并将其放入文件夹中。我重新启动了 RStudio,但它仍然不会自动加载文件。

来自高效的 R 编程https://csgillespie.github.io/efficientR/3-3-r-startup.html我尝试了以下方法:

site_path = R.home(component = "home")
fname = file.path(site_path, "etc", "Rprofile.site")
file.exists(fname) 

但尽管文件在目录中,但它产生了 False。

我确保在 yi hui 的帖子中添加了一个额外的行:https://yihui.name/en/2018/04/rprofile-trailing-newline/,但它仍然不起作用。

此外,我遵循了许多其他 SO 和 RStudio 线程的建议,但无济于事。

参考文献

Getting .Rprofile to Load at Startup

https://community.rstudio.com/t/create-rprofile-automatically-when-creating-new-project/3719

https://support.rstudio.com/hc/en-us/community/posts/200657076-Also-load-the-user-s-Rprofile-when-opening-a-project-with-a-project-specific-Rprofile

【问题讨论】:

    标签: r macos rprofile


    【解决方案1】:

    解决方案

    我右键单击 Rprofile.site 文件并删除了仍然挂在实际文件上的 .R。尽管在 Finder 中对其进行了重命名,但 .R 扩展名仍然存在,因此 R 无法识别。

    【讨论】:

      最近更新 更多