Unable to install R package - r

When I tried to install the package coxphf, the following error appeared.
Please let me know how to solve this:
install.packages("coxphf")
> Installing package into ‘C:/Users/User/R/win-library/3.4’
> (as ‘lib’ is unspecified)
> trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/coxphf_1.12.zip'
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/coxphf_1.12.zip': HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/coxphf_1.12.zip'
Warning in install.packages :
download of package ‘coxphf’ failed

Looks like the package isn't available on CRAN at that address.
After digging around, I found the package here: https://cran.rstudio.com/bin/windows/contrib/3.4/coxphf_1.13.zip
Download it and follow instructions here:
http://stat.columbia.edu/~gelman/bugsR/alternate_install.html
It's not expected behavior though, I'm not sure what's causing it, but this workaround will do fine for now

Related

Can't Install Package "sp"

I am new to geospatial analysis in R as all of my previous experience is in bioinformatics work. I am attempting to install some of the basic geospatial packages, but am having some issues, specifically revolving around installing the package "sp". When attempt I install.packages("sp") I get the following result:
install.packages("sp")
Installing package into ‘C:/Users/LMetz/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/sp_1.4-7.zip'
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/sp_1.4-7.zip': HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/sp_1.4-7.zip'
Warning in install.packages :
download of package ‘sp’ failed
It appears that the URL install.packages is trying to access to download the package no longer exists. Does anyone know what I need to do to fix this? Thanks.

How to install "mxnet" package in R 4.0.2

Good afternoon. Recently I have encountered the problem with installing "mxnet" package. I have tried several variants of code, but neither of their actually installs this package.
1.
cran <- getOption("repos")
cran["dmlc"] <- "https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/15"
options(repos = cran)
install.packages("mxnet")
library(mxnet)
And get the error like this:
Error: package or namespace load failed for ‘mxnet’: package ‘mxnet’
was installed before R 4.0.0: please re-install it
install.packages("https://github.com/jeremiedb/mxnet_winbin/raw/master/mxnet.zip", repos = NULL)
Then I type library(mxnet) and get the error message as in p.1.
3.
cran <- getOption("repos")
cran["dmlc"] <- "https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23"
options(repos = cran)
library(devtools)
require(devtools)
install_version("DiagrammeR", version = "0.9.0", repos = "http://cran.us.r-project.org")
require(DiagrammeR)
install.packages("mxnet")
library(mxnet)
After executing this code I get the following error:
ERROR: failed to lock directory 'C:/Users/user/Documents/R/win-library/4.0' for modifying
Try removing 'C:/Users/user/Documents/R/win-library/4.0/00LOCK-rlang'
Error: Failed to install 'unknown package' from URL:
(converted from warning) installation of package ‘rlang’ had non-zero exit status
> install.packages("mxnet")
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES.rds': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib:
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES'
Installing package into ‘C:/Users/user/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES.rds': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib:
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/src/contrib/PACKAGES'
Warning in install.packages :
package ‘mxnet’ is not available (for R version 4.0.2)
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/bin/windows/contrib/4.0/PACKAGES.rds': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/bin/windows/contrib/4.0/PACKAGES.gz': HTTP status was '404 Not Found'
Warning in install.packages :
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/bin/windows/contrib/4.0/PACKAGES': HTTP status was '404 Not Found'
Warning in install.packages :
unable to access index for repository https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/bin/windows/contrib/4.0:
cannot open URL 'https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/R/CRAN/23/bin/windows/contrib/4.0/PACKAGES'
In the end, mxnet package hasn't been installed in RStudio yet.
I have familizrized myself with MXNet package installation in R , but some of the instructions, given there, didn't bring any help. Other coincide with my code.
Could you, please, tell me, how to successfully install this package? What code should I run?
Thank you for your effort.
As there is no prebuilt MXNet binary available for the version of R that you are using, you will need to follow the build from source instructions. Please see https://mxnet.apache.org/versions/1.7.0/get_started/build_from_source
You can follow these instructions but use the 1.8.0rc2 release archive instead of 1.7.0 if you like.
This question is duplicate of R: namespace load failed for ‘mxnet’: package ‘mxnet’ was installed before R 4.0.0: please re-install it but can't be flagged as duplicate as there are no accepted answers.

jsonlite for R gives error when trying to install

Where does one get jsonlite? Apparently it is missing from CRAN?
> install.packages('jsonlite')
Gives:
Installing package into ‘C:/Users/cbusch/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/jsonlite_0.9.20.zip'
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/jsonlite_0.9.20.zip': HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/jsonlite_0.9.20.zip'
Warning in install.packages :
download of package ‘jsonlite’ failed
Any suggestions?
Like #user5249203 said:
install.packages('jsonlite', dependencies=TRUE, repos='http://cran.rstudio.com/')

Issue in installation of mxnet package in R

mxnet package is not installing in r (on windows 10) when I follow the steps given in its documentation.
install.packages("drat", repos="https://cran.rstudio.com")
drat:::addRepo("dmlc")
install.packages("mxnet")
It gives the following result
Installing package into ‘C:/Users/Ashish/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified) Warning in install.packages : cannot open
URL 'http://dmlc.github.io/drat/bin/windows/contrib/3.3/PACKAGES.gz':
HTTP status was '404 Not Found' Warning in install.packages : cannot
open URL
'http://dmlc.github.io/drat/bin/windows/contrib/3.3/PACKAGES': HTTP
status was '404 Not Found' Warning in install.packages : unable to
access index for repository
http://dmlc.github.io/drat/bin/windows/contrib/3.3: cannot open URL
'http://dmlc.github.io/drat/bin/windows/contrib/3.3/PACKAGES' Package
which is only available in source form, and may need compilation of
C/C++/Fortran: ‘mxnet’ Do you want to attempt to install these from
sources? y/n: y installing the source package ‘mxnet’
trying URL 'http://dmlc.github.io/drat/src/contrib/mxnet_0.5.tar.gz'
Warning in install.packages : cannot open URL
'http://dmlc.github.io/drat/src/contrib/mxnet_0.5.tar.gz': HTTP status
was '404 Not Found' Error in download.file(url, destfile, method, mode
= "wb", ...) : cannot open URL 'http://dmlc.github.io/drat/src/contrib/mxnet_0.5.tar.gz' Warning in
install.packages : download of package ‘mxnet’ failed
Kindly help me resolve this issue. I'm using R version 3.3.0. Is there any other way of installing it in R?
I was able to install it successfully by first downloading its zip file from the following link
https://github.com/dmlc/drat/tree/gh-pages/bin/windows/contrib/3.2
and then installing it using RStudio.
I hope this answer will help anyone else facing the same problem.
I had the same issue and was able to resolve it by following the instructions on this page and choosing the correct OS, Language and CPU/GPU options:
http://mxnet.io/get_started/install.html
The only thing that worked for me was to download the mxnet.zip file to a folder, (set it as working directory) and type:
install.packages("mxnet.zip", repos=NULL, type="win.binary")
You can try using different repo in repos.
Otherwise you can download the drat package along with dependencies and install manually.
Check if these URLs are accessible from your machine or not.
Following links will be helpful for you:
http://mxnet-bing.readthedocs.io/en/latest/build.html#r-package-installation
https://github.com/dmlc/mxnet/issues/1085
The more up-to-date Installation Guide is currently located here:
http://mxnet.io/get_started/setup.html#installing-mxnet
I found the paragraph about the installation of the R-package on Windows to be very well written.
By the way, the install.packages("mxnet") command installs a very long tool chain, so it might happen that a package is currently not indexed correctly in the dmlc-repo (i.e. because it was just updated to a newer version on CRAN): Error: package <pkgname> is not available for R version 3.3.1 So you might want to install the "offending" package from the CRAN (or download the sourcecode and use something like install.packages(file.choose(), repos = NULL, type = "source")), then continue with another call to install.packages("mxnet").
try these commands to install mxnet package:--
cran <- getOption("repos")
cran["dmlc"] <- "https://s3-us-west-2.amazonaws.com/apache-mxnet/R/CRAN/"
options(repos = cran)
install.packages("mxnet")

Warning in install.packages : cannot open: HTTP status was '404 Not Found'

I have attempted to download R package memoise:
install.packages("memoise")
However, I have recevied the following error message:
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.0/memoise_0.1.zip'
Warning in install.packages :
cannot open: HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.0/memoise_0.1.zip'
Warning in install.packages :
download of package ‘memoise’ failed`
I am connected to the internet and the WWW. In addition, I am connected to a work network. I am using the RStudio IDE.
Does anyone have any advice for how I troubleshoot this problem?
as I can see there is no "memoise_0.1.zip" at http://cran.rstudio.com/bin/windows/contrib/3.0/ . However, there is the "memoise_0.2.1.zip" file.
What version of RStudio IDE are you using? Do you have memoise already installed? Maybe you should try to update the memoise package.
I returned to this problem this morning. I restarted RStudio and tried the following again:
install.packages("memoise")
This time I received the following response:
Installing package into ‘\\oxdc/userdata/jolyon.faria/Documents/R/win-library/3.0’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.0/memoise_0.2.1.zip'
Content type 'application/zip' length 16813 bytes (16 Kb)
opened URL
downloaded 16 Kb
This time it (unexpectedly) 'found' the correct webpage so problem solved. Thanks for your help.

Resources