问题
I'm working on a different computer than usual and so installing packages for the first time. Trying to install ggplot2 resulted in the following error.
install.packages("ggplot2")
also installing the dependency ‘withr’
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/withr_2.3.0.tgz'
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/withr_2.3.0.tgz': HTTP status was '404 Not Found'
Error in download.file(url, destfile, method, mode = "wb", ...) :
cannot open URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/withr_2.3.0.tgz'
Warning in install.packages :
download of package ‘withr’ failed
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/ggplot2_3.3.2.tgz'
Content type 'application/x-gzip' length 4064530 bytes (3.9 MB)
==================================================
downloaded 3.9 MB
I've tried install just "withr" and get the same error. I've tried manually downloading the zip file of an older repo for "withr" and unpacking it in the library folder but that gives the following error.
Error: package or namespace load failed for ‘ggplot2’: .onAttach failed in attachNamespace() for 'ggplot2', details: call: NULL error: package ‘withr’ was installed before R 4.0.0: please re-install it
It seems that the URL for 'withr' is simply broken and there is no way to get the package at the moment; so any packages that depend on it also cannot be installed. Has any else experienced this or found a solution? How can I contact CRAN and let them know the link is dead?
Link for the MacOS version is here https://cran.r-project.org/bin/macosx/contrib/4.0/withr_2.2.0.tgz
来源:https://stackoverflow.com/questions/64050756/getting-an-error-installing-r-package-withr-as-a-dependency-for-ggplot2-how