I have download this package as a zip file.
Is it possible to install it from R console using this zip or unzip version to a specific path?
install.p
On Windows 7 and R 3.5.3 I had to extract the zip, repackage it as .tar.gz and then install it using the command below. When installing the zip the package will not be indexed by R.
install.packages("C:/your-package.tar.gz", repos = NULL, type = "win.binary", lib="C:/Users/username/Documents/R/R-3.5.3/library")
Environment
version _
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 5.3
year 2019
month 03
day 11
svn rev 76217
language R
version.string R version 3.5.3 (2019-03-11) nickname Great Truth
You can make use of install_local method in devtools package. Unzip the zipped file and specify the folder which contains DESCRIPTION file of the package in the path argument or you can also make use of subdir argument.
If it doesn't explains, I will post an example... Let me know.
If this is the zip of the source of a package, and the R core install.packages()
doesn't work, then you can use install_local()
from the devtools
package.
I often do this when installing packages from GitHub as getting curl through our proxy is painful. So I download the source zip and install like this.
You have downloaded a zip of the source of a package. This is not the standard packaging of a package source nor is it a standard Windows binary (i.e., a built package distributed as a .zip, as from CRAN).
The easiest thing for you to do is to install this package directly from Github using devtools:
library("devtools")
install_github("hadley/rvest")
If you decide to install it locally, you need to unzip the package directory, build it from the command line using R CMD build rvest
and then install either using R CMD INSTALL
or from within R using the command you already have (but performed on the built "tarball"). Here's how you could do all of this from within R:
setwd("C:/Users/Desktop/")
unzip("rvest-master.zip")
file.rename("rvest-master", "rvest")
shell("R CMD build rvest")
This will make a tarball version of the package in the current directory. You can then install that with
install.packages("rvest_0.2.0.9000.tar.gz", repos = NULL)
Since the version number is merged into the tarball name, it may not always be obvious what the new file might be called. You can use list.files()
to grab the new tarball.
install.packages(list.files(pattern="rvest*.tar.gz"), repos = NULL)
If the shell()
line gives you an error like this
'R' is not recognized as an internal or external command
You need to make sure that R is in your shell path. You can add it with something like
Sys.setenv(PATH=paste(R.home("bin"), Sys.getenv("PATH"), sep=";"))
Download the package.tar.gz
Then from command line :
R CMD INSTALL package.tar.gz
Hard to believe this don't have a clear, simple and accurate answer.
devtools::install_local
. If devtools bring too many dependencies to you, you can use remotes::install_local
which is the real function and have much less dependencies.