rrstudioblogdownrprofile

.Rprofile not sourced


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!


Solution

  • 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.