.Rprofile not sourced

走远了吗. 提交于 2020-07-05 07:47:16

问题


I am trying to set some global options for blogdown package in ~/.Rprofile script but they are not being sourced. Here's how the .Rprofile script looks like:

options(blogdown.ext = ".Rmd", blogdown.author = "Maryam Khezrzadeh")

I have also tried setting the options at the project level by creating an .Rprofile script in my project's working directory. but that doesn't get sourced either.

I have restarted the R session from within RStudio and have also restarted RStudio and finally restarted my computer. No luck.

Even when I just use base R (and not R Studio), the options are not set.

if I manually source .Rprofile (source("~/.Rprofile")), then the options will take effect, meaning that the blogdown's "New Post" addin for RStudio will show the right author name (Maryam Khezrzadeh) and would choose .Rmd files by default.

I'm on a MacOS Sierra (version 10.12.6) and here are the values of relevant environment variables:

R_HOME = "/Library/Frameworks/R.framework/Resources"
R_PROFILE_USER = ""
R_PROFILE = ""

Any advice on how to go about troubleshooting this is appreciated. Thank you so much for your help!


回答1:


The solution is to make sure that there is a trailing new line at the end of .Rprofile script. Thanks to Yihui Xie for the answer.

See this blog post to find out what is the trouble of .Rprofile if it doesn't have a trailing newline.



来源:https://stackoverflow.com/questions/50686292/rprofile-not-sourced

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!