5

I have Ubuntu 16.04 and after update of R to 3.4.1 version it does not see my packages even though they have also been updated:

> library(dplyr)
Error in library(dplyr) : there is no package called ‘dplyr’

Packages are there:

$ ls ~/R/x86_64-pc-linux-gnu-library/3.4/ | grep plyr
dplyr
plyr

My .libPaths:

> .libPaths()
[1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"       "/usr/lib/R/library" 

Setting .libPaths to desired path does the thing just for one session. I'd like it to be permanent.

I also tried to set the variables R_LIBS, R_LIBS_SITE and R_LIBS_USER to desired path as indicated here but it worked only in the console (didn't work in RStudio).

4
  • The problems are almost the same but mine considers Linux not Windows and none of the answers solves my problem.
    – potockan
    Commented Jul 4, 2017 at 9:05
  • That is fair enough - Maybe you could have found some inspiration for solving it. Mark your own answer as accepted so others can see the solution :)
    – kristang
    Commented Jul 4, 2017 at 9:16
  • I can't accept it for another 2 days.
    – potockan
    Commented Jul 4, 2017 at 10:07
  • Looking at this post this looks like planned behaviour and the 'canonical' solution is to make usr/local/lib/R/ writable for all users who will use R. See this post, this thread and steps for making this folder writable
    – Phil
    Commented Jul 4, 2017 at 10:16

3 Answers 3

6

Found the solution: In the file /usr/lib/R/etc/Renviron there is a configuration of R.

In lines 43-45 there is:

# edd Jun 2017  Comment-out R_LIBS_USER
#R_LIBS_USER=${R_LIBS_USER-'~/R/x86_64-pc-linux-gnu-library/3.4'}
##R_LIBS_USER=${R_LIBS_USER-'~/Library/R/3.4/library'}

I have uncommented R_LIBS_USER=${R_LIBS_USER-'~/R/x86_64-pc-linux-gnu-library/3.4'}, restarted RStudio and now it works.

EDIT: Looking at the comments, it seems like a planned behaviour. Here is another solution.

0

I had a similar problem with Ubuntu 16.04. Call terminal R and try to install one any package in the terminal. Then use rstudio.

0

I had the same problem on Windows, maybe my solution works for you aswell. The default for R-Studio seems to be, that it looks for the packages in a folder that has the same name as the most recent R version you have installed.

So check in the Library Settings for R-Studio, (e. g. Tools -> Install packages -> Path beneath the search bar) it should say some path ending in ~/3.4.1 [Default], whereas the packages currently lie in ~/3.4.

What I did:

Copy/move the content from ~/3.4 to ~/3.4.1.

This is obviously not the nicest way, since that means moving the packages with every R update, but it worked for me.

Edit: formatting.

1
  • Going into ` Tools -> Install packages` I have: Would you like to create a personal library 'null' to install packages into?.
    – potockan
    Commented Jul 4, 2017 at 8:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.