I've tried to run this command:
url <- 'http://www.rob-mcculloch.org/chm/nonlinvarsel_0.0.1.9001.tar.gz'
download.file(url, destfile = 'temp')
install.packages('temp', repos = NULL, type='source')
But at first, when I ran download.file, that returned me:
Warning messages: 1: In download.file(url, destfile = "temp") : URL http://www.rob-mcculloch.org/chm/nonlinvarsel_0.0.1.9001.tar.gz: cannot open destfile 'temp', reason 'Is a directory' 2: In download.file(url, destfile = "temp") : download had nonzero exit status
So I tried to run install.packages and that returned me:
Installing package into ‘/usr/local/lib/R/site-library’ (as ‘lib’ is unspecified) Warning: invalid package ‘temp’ Error: ERROR: no packages specified Warning message: In install.packages("temp", repos = NULL, type = "source") : installation of package ‘temp’ had non-zero exit status
CodePudding user response:
You don't have to do it from inside R (though that is doable, just look more close at options and see below). I actually like the shell for this:
/tmp> wget http://www.rob-mcculloch.org/chm/nonlinvarsel_0.0.1.9001.tar.gz
--2022-04-11 03:03:59-- http://www.rob-mcculloch.org/chm/nonlinvarsel_0.0.1.9001.tar.gz
Resolving www.rob-mcculloch.org (www.rob-mcculloch.org)... 162.241.219.65
Connecting to www.rob-mcculloch.org (www.rob-mcculloch.org)|162.241.219.65|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20001 (20K) [application/x-gzip]
Saving to: ‘nonlinvarsel_0.0.1.9001.tar.gz’
nonlinvarsel_0.0.1.9001.tar.gz 100%[=====================================================================================================================>] 19.53K --.-KB/s in 0.03s
2022-04-11 03:03:59 (634 KB/s) - ‘nonlinvarsel_0.0.1.9001.tar.gz’ saved [20001/20001]
/tmp> R CMD INSTALL nonlinvarsel_0.0.1.9001.tar.gz
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘nonlinvarsel’ ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (nonlinvarsel)
/tmp>
Or equally within R (where I also switch to /tmp
) first:
> setwd("/tmp")
> download.file("http://www.rob-mcculloch.org/chm/nonlinvarsel_0.0.1.9001.tar.gz", "nonlinvarsel_0.0.1.9001.tar.gz")
trying URL 'http://www.rob-mcculloch.org/chm/nonlinvarsel_0.0.1.9001.tar.gz'
Content type 'application/x-gzip' length 20001 bytes (19 KB)
==================================================
downloaded 19 KB
> install.packages("nonlinvarsel_0.0.1.9001.tar.gz", repos = NULL)
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘nonlinvarsel’ ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (nonlinvarsel)
>