0

I have installed an R project on a network. It automatically installs the library in the C:\Users\\AppData\Local\Temp\downloaded_packages, however, I would like to install the library to lets say Q:\Apps\R-Project\Libraries.

I managed to install the library to the Q network using the following command:

install.packages("dplyr", lib="Q:\Apps\R-Project\Libraries", dependencies=T)

When I load the library it says that it cannot find the Rccp.

Any help how to solve that issue?

KenHBS
  • 6,756
  • 6
  • 37
  • 52
J.Ze
  • 73
  • 2
  • 11
  • Make sure is in your `.libPath()`. You can add it with `.libPath() <- c(.libPath(), "Q:\Apps\R-Project\Libraries")` – emilliman5 Sep 15 '17 at 12:49

1 Answers1

2

You told R to install the package in a certain location, namely Q:\Apps\R-Project\Libraries.

When you tell R to use a certain package, R will not search your entire computer whether that package exists. Usually, the packages are being saved in a standard location that R knows and where R will also search for it, once you tell it to use that package. You can view these locations with .libPaths().

If Q:\Apps\R-Project\Libraries is not a location that you have saved in .libPaths(), you have two options:

# 1) Add it to `.libPaths()` like this: 
.libPaths( c( .libPaths(), "Q:\Apps\R-Project\Libraries") )

# 2) Tell `R` explicitly where to look while loading the package:     
library(packagename, lib.loc = "Q:\Apps\R-Project\Libraries")

I recommend using option 1

KenHBS
  • 6,756
  • 6
  • 37
  • 52
  • Hi, Thank you for your response. I try the first approach and when I load the library it says: Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : there is no package called ‘Rcpp’ – J.Ze Sep 15 '17 at 13:57
  • While you are trying to load `dplyr`? – KenHBS Sep 15 '17 at 13:58
  • yes. I use you know normal install.packages("dplyr", dependencies=T). Thank you again for your quick response :) – J.Ze Sep 15 '17 at 14:02
  • That can happen. `Rcpp` is being loaded automatically when you load `dplyr`. Somehow `Rcpp` and `dplyr` need to be installed in the same location, in order for them to nicely work together and fullfill their dependencies. Check this answer for more information https://stackoverflow.com/a/16759366/6256482 – KenHBS Sep 15 '17 at 14:05