简体   繁体   中英

Loading R packages from custom library locations when there's no read/write access to default library location

We use R at my university, where all computers run Windows XP or Windows 7 and read/write access to most places on the C drive is disabled. This includes the default directory for downloading and installing R packages, but does not include the Downloads folder, so I've been using this work-around:

install.packages("plyr",lib="C:/Users/g-rde434/Downloads/")
library(plyr,lib.loc="C:/Users/g-rde434/Downloads/")

where g-rde434 is the username and I'm just using plyr as an example. For packages that require a lot of other packages in order to work, this gets messy because I've found that I have to manually install all the depends before I can install the package I actually want to use. For instances, packages like ggplot2 and sirt each require a whole bunch of other packages to work properly. Is there a much easier way to do what I'm trying to do? I'm not asking about clever vectorizing tricks or anything like that, but rather some way to force the "higher-up" packages (eg, ggplot2 or sirt ) to load all the other packages it needs from the library location I specified above?

Please try:

install.packages("plyr", lib="C:/Users/g-rde434/Downloads/", dependencies=TRUE)

For further reference see: How to tell CRAN to install package dependencies automatically?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM