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

StackOverflow https://stackoverflow.com/questions/21970460

  •  15-10-2022
  •  | 
  •  

質問

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 (e.g., 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?

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top