Installing R packages available for all users

后端 未结 3 1732
野趣味
野趣味 2020-12-24 02:08

I have a few R packages installed under ~/R/i486-pc-linux-gnu-library/2.11.

I would like to make them, and any other R package I install from now on, a

相关标签:
3条回答
  • 2020-12-24 02:50

    In your case, the easiest way would be to install the packages as root (or as administrator in case of Windows), they'll be available for every user on that machine.

    0 讨论(0)
  • 2020-12-24 02:54

    aL3xa gives (IMHO) bad advice. Do not mess with /usr which is handled by the package management system. Instead, use the facility provided by /usr/local/lib/R/site-library.

    That latter directory is already searched by default. All you need to do is to add yourself to group staff as that group has write-rights there -- try adduser yourid staff where yourid is your user name on the system. Afterwards you should be able to install there without problems.

    Another thing you may like on Ubuntu is apt-get install littler and then use the install.r and upgrade.r helper scripts from the examples directory. I use them all the time.

    0 讨论(0)
  • 2020-12-24 03:14

    aL3xa answer is wrong; you shouldn't expose those directories to write for all users.
    Run R as a root (probably using sudo R) and then install packages as usual -- they will be placed in a global library and will be available for all users.

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