J.Ze
J.Ze

Reputation: 73

Install r libraries

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?

Upvotes: 0

Views: 200

Answers (1)

KenHBS
KenHBS

Reputation: 7164

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

Upvotes: 2

Related Questions