Can't install package "sp"


I just reinstalled R, Rtool, and RStudio. Then I ran install.pacakges("sp"). And it is giving me a version error when I ran the following:

> install.packages("sp")
Installing package into ‘C:/Users/User/OneDrive/Dokumen/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL ''
Warning in install.packages :
  cannot open URL '': HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) : 
  cannot open URL ''
Warning in install.packages :
  download of package ‘sp’ failed

Hope someone can help me.

Try to change to a local repository in "Tools"-"Global Options"-"Packages"-"Primary CRAN repository"

Can you download the zip by following the link in your browser?
If not, then you can't access a publicly available file over the internet from your setup, if you have IT support, seek it to understand what is blocking you... VPN, security...
If yes, then its specifically the R download that is an issue, I would try different download methods in R
make a note of your current method by :


try different methods
Current download methods are "internal" , "wininet" (Windows only) "libcurl" , "wget" and "curl"

options(download.file.method = "curl")

Actually I want to do install.package("spdep"). To install spdep required package sp. But when I install the sp package, it gets an error. i've tried to download the sp zip on the CRAN browser but it doesn't work. Then I downloaded the spdep zip on CRAN browser and it worked. Thank you for your answer :slight_smile:

Thank you for answering and helping me :slight_smile:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.