I have been using the "stats" package in R 3.0.1 without any problems . But today i deleted the "stats" folder from the R library location and now I can't install it any more. I tried doing the same thing with other packages but I could install everything except "stats"
install.packages("stats", dep = TRUE, repos="http://cran.cs.wwu.edu")
## Installing package into ‘%Default R Lib Installation Path%’
## (as ‘lib’ is unspecified)
## Warning in install.packages : package ‘stats’ is not available (for R version 3.0.1)
I also tried downloading it from other sources like "http://cran.ma.imperial.ac.uk/" but nothing works . Any ideas?
(Since SO is nagging me not to continue the comment thread, I will post an answer.)
I believe that this problem will apply to any base package (but not to those installed from repositories, and probably not to Recommended packages): I am deeply skeptical that stats
is the only package. It should occur for any of the packages in this list:
rownames(subset(as.data.frame(installed.packages()),Priority=="base"))
I'm sure it's theoretically possible to re-install a base package from scratch, but it will be much easier to re-install R. At a guess, it would take me about 15 minutes to re-install R, and I would feel lucky if I figured out how to re-install a base package on its own in less than an hour.
I'm pretty sure that re-installing R will not affect previously-installed packages: see e.g. http://cran.r-project.org/bin/windows/base/rw-FAQ.html#How-do-I-UNinstall-R_003f; that link is about uninstalling rather than re-installing, but this seems relevant:
Uninstalling R only removes files from the initial installation, not (for example) packages you have installed or updated.
Other choices would be
PS: obviously if you are doing this on a client's machine it would be a good idea to test my advice first ...