【发布时间】: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
【问题讨论】: