Getting .Rprofile to Load at Startup

前端 未结 1 2004
独厮守ぢ
独厮守ぢ 2021-01-17 17:46

I have a global ~/.Rprofile file and another .Rprofile file located in my project\'s current working directory and both of the have the following c

相关标签:
1条回答
  • 2021-01-17 18:16

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

    > ?Startup
    

    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.

    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

    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.

    Josh

    Product Manager - RStudio

    0 讨论(0)
提交回复
热议问题