Reputation: 808
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:
Error in `install.packages("C://path//to//directory",` :
type == "both" cannot be used with 'repos = NULL'
I also cannot install devtools. Any ideas?
Upvotes: 33
Views: 79605
Reputation: 597
e.g. from github
# Install
if(!require(devtools)) install.packages("devtools")
devtools::install_github("kassambara/ggpubr")
#Or, install from CRAN as follow:
install.packages("ggpubr")
from zipped win-binary r-release (loaded from here with manual here)
install.packages("C:\\evir_1.7-4.zip", repos = NULL, type="source")
library(evir)
# TEST IT - from manual:
# Find threshold giving (at least) fifty exceedances for Danish data
data(danish)
findthresh(danish, 50)
Upvotes: 1
Reputation: 367
If it is a package that has been removed from the repo but you have an installed version (and want to e.g. move it), you can do this in RStudio on Windows:
I have just managed to move an obsolete package using this method and it can be loaded as expected.
Upvotes: 2
Reputation: 2283
I was able to do this using devtools:
devtools::install("path/to/package/folder")
Upvotes: 9
Reputation: 11
Go to R-studio
Click the install icon in the packages section found in the right side of the window
A new window pops up
Set "Install from: Package Archive file" "Package Archive: Browse the unzipped file and select it"
Click install
This installs the package to the R library
Upvotes: 1
Reputation: 591
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")
Upvotes: 53
Reputation: 1575
If you have zip file, you can install as follows
install.packages("E:\\R-Packages\\plyr_1.8.4.zip", repos = NULL, type="source")
Upvotes: 3
Reputation: 44565
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.
Upvotes: 6
Reputation: 9705
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")
Upvotes: 7