rstudio different library path to command-line R (`$R_LIBS_USER`)

后端 未结 2 913
执念已碎
执念已碎 2021-02-08 05:36

I\'m trying to work out why my .libPath is different between command-line R and RStudio Desktop (NOTE: this is not a duplicate of

相关标签:
2条回答
  • 2021-02-08 06:17

    Just to document here in case someone finds it useful, according to ArchWiki we can define R_LIBS_USER in ~/.Renviron, which I feel is a more convenient way to define specific variables for R.

    0 讨论(0)
  • 2021-02-08 06:27

    You write:

    Now I have set $R_LIBS_USER to ~/R/library in my bash profile,

    Do you by chance call RStudio from a gui icon, ie without invoking your ~/.bash_profile ? Maybe you can try calling a wrapper instead which sets it?

    For what it is worth, .libPaths() returns the same thing under RStudio Desktop and Server (though Server appends its internal directory), R on the command-line and via ESS for me.

    Edit: And in general, do read help(Startup) which will be time well-spent. The comment by @flodel is quite appropriate. If you get lost dealing with this consistently at the system level, you can always turn to R, either at its system-level (via Renviron and Renviron.site) or via the ~/R/ directory.

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