Can't Install Package "sp" - r

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.

Related

Problems installing R package heplots

I tried to install R package "heplots" in R 4.1.3 using Rstudio but I get the following error:
Warning in install.packages :
unable to access index for repository https://cran.rstudio.com/src/contrib:
cannot open destfile 'C:\Users\myuser\AppData\Local\Temp\RtmpiIlWmJ\file821048e42b13', reason 'No such file or directory'
Installing package into ‘C:/Users/myuser/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
Warning in install.packages :
unable to access index for repository https://cran.rstudio.com/src/contrib:
cannot open destfile 'C:\Users\myuser\AppData\Local\Temp\RtmpiIlWmJ\file8210644e40c6', reason 'No such file or directory'
Warning in install.packages :
package ‘heplots’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
Warning in install.packages :
unable to access index for repository https://cran.rstudio.com/bin/windows/contrib/4.1:
cannot open destfile 'C:\Users\myuser\AppData\Local\Temp\RtmpiIlWmJ\file8210db01a9c', reason 'No such file or directory'
This appeared when I used the install.packages function. If I download the .tar.gz file from CRAN and try to install it that way I get this message:
Installing package into ‘C:/Users/guill/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
ERROR: dependency 'car' is not available for package 'heplots'
* removing 'C:/Users/myuser/Documents/R/win-library/4.1/heplots'
Warning in install.packages :
installation of package ‘C:/Users/myuser/Downloads/heplots_1.3-9.tar.gz’ had non-zero exit status
So I thought that if I install "car" then it would work. The problem is that the same happens with car and a lot of new dependenies appear (also the imports need to be installed), and when I try to install those manually they also have their own dependencies that need installing. I surrendered after the fourth layer of dependencies. Anyone knows how it should be done or am I stuck on manual dependency hell?

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.

Unable to install R package

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

Unable to install Rcpp package when loading forecast

When I try to load the forecast package it trows me the error that there is not Rcpp package which it depends on
by trying to install Rcpp package manually i get the following error
install.packages("Rcpp")
Installing package into ‘C:/Users/~~~’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is later:
binary source needs_compilation
Rcpp 0.12.10 0.12.11 TRUE
Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/Rcpp_0.12.10.zip'
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/Rcpp_0.12.10.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/Rcpp_0.12.10.zip'
Warning in install.packages :
download of package ‘Rcpp’ failed
This is a likely duplicate. You misunderstand the meaning of There is a binary version available but the source version is later..
Install from source, use a different mirror, or just wait.
The 0.12.11 binary is clearly there in Vienna and at the 0-cloud mirrors.

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/')

Resources