Installing an R package from local unzipped folder
Installing an R package from local unzipped folder
I am having difficulty installing an unzipped package on a Windows 7 computer without administrative privileges and no internet access. I am using the RGui (not RStudio).
Right now I have an unzipped library sitting in a directory. Unfortunately, when I try:
install.packages("C://path//to//directory",
repos = NULL,
lib = "C://path//to//newDirectory")
I am getting the error:
Warning in `install.packages("C://path//to//directory",` :
'lib = "C://path//to//newDirectory"' is not writable
Which is strange because I do have write privileges to where I am attempting to store the package.
When I get this error, I also get a popup from RGui:
Would you like to use a personal library instead?
If I click Yes
, it throws the error:
Yes
Error in `install.packages("C://path//to//directory",` :
type == "both" cannot be used with 'repos = NULL'
I also cannot install devtools. Any ideas?
4 Answers
4
If it is an unzipped Windows binary (e.g., from CRAN), you can just copy and paste the entire package directory into your library folder. You could also, presumably, use file.copy()
to do so if you wanted to do it within R. install.packages()
is failing (weirdly) because you're giving it something other than the typical package source or zipped binary that it is expecting.
file.copy()
install.packages()
I think the error message is actually just wrong. You need to give the file name of the package, not just the directory.
install.packages("C://path//to//directory//MY_PACKAGE.tar.gz",
repos = NULL,
lib = "C://path//to//newDirectory")
Thanks for the reply! The issue is I no longer have the compressed package, I'm wondering if I can do it on a folder instead of a tar.gz?
– Edward Tyler
Mar 31 '17 at 23:58
I am pretty sure you can't do that. But you can rebuild your package from the command line using: R CMD build MY_PACKAGE
– thc
Apr 1 '17 at 2:39
I'm beginning to think you're right :-/
– Edward Tyler
Apr 1 '17 at 5:08
If you have zip file, you can install as follows
install.packages("E:R-Packagesplyr_1.8.4.zip", repos = NULL, type="source")
The solution to installing a package that's been unzipped into a folder is as follows:
install.packages("C:/path to folder with the package",
repos = NULL,
type = "source")
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
This is absolutely right. Thanks!
– Edward Tyler
Apr 2 '17 at 15:47