4

I have been using R Studio through which I have installed a large number of R libraries to my system. Recently I begun working through Jupyter Notebook with an R Kernel. However I am facing 2 problems:

a) I can not access libraries I have already installed in my system -- such as dplyr

b) I can not reinstall these libraries from within Jupyter Notebook:

install.packages("dplyr", dependencies = TRUE, repos = "http://cran.us.r-project.org")
Installing package into 'C:/Install/R_LIBS'
(as 'lib' is unspecified)
also installing the dependency 'tibble'

package 'tibble' successfully unpacked and MD5 sums checked
Warning message:
"cannot remove prior installation of package 'tibble'"
package 'dplyr' successfully unpacked and MD5 sums checked
Warning message:
"cannot remove prior installation of package 'dplyr'"

The downloaded binary packages are in
    C:\Users\akonstantinidis\AppData\Local\Temp\RtmpqUPKMw\downloaded_packages

library(dplyr)

Error in library(dplyr): there is no package called 'dplyr'
Traceback:

1. library(dplyr)
2. stop(txt, domain = NA)

Your advice will be appreciated.

Edit

As Alistaire very helpfully and kindly suggested in the comment below this post, I run the command .libPaths() from within RStudio and the from within Jupyter Notebook.

The results were the following:

RStudio:

"C:/Install/R_LIBS"    "C:/Program Files/Microsoft/R Server/R_SERVER/library"

Jupyter Notebook

'C:/Install/R_LIBS' 'C:/ProgramData/Anaconda3/R/library'

Then I changed the library paths so that:

.libPaths()
'C:/Install/R_LIBS' 'C:/Program Files/Microsoft/R Server/R_SERVER/library' 'C:/ProgramData/Anaconda3/R/library'

Nonetheless, when I tried to load the dplyr library I got the same error message:

library(dplyr)
Error in library(dplyr): there is no package called 'dplyr'
Traceback:

1. library(dplyr)
2. stop(txt, domain = NA)
rf7
  • 1,993
  • 4
  • 21
  • 35
  • I've always found packages show up regardless of what interface I use, but I'm not on Windows, so things are arranged a little differently. Regardless, I'd check where `.libPaths()` points for each interface; that's where R installs and looks for packages. – alistaire Oct 17 '17 at 03:05
  • Thank you. Please see edited post. – rf7 Oct 17 '17 at 04:59
  • Go look at those directories and see where the packages are actually installed, then make the results of `.libPaths` look the same, either by using it to set the values or [by using environment variables](https://stackoverflow.com/a/19662905/4497050), which seems to be the proper way on Windows. – alistaire Oct 17 '17 at 05:57
  • Thank you for bearing with me! Please find in my post more info. – rf7 Oct 17 '17 at 09:29

0 Answers0