You can install repositories in your .Rprofile to restore your selection every time you start R
Edit: to be more precise:
add
options(repos=structure(c(CRAN="YOUR FAVORITE MIRROR")))
to your .Rprofile
Alternatively, you can install a mirror for the entire site in your Rprofile.site . The file location is defined as ?Startup :
The path to this file is taken from the value of the environment variable R_PROFILE (after R_PROFILE tilde). If this variable is not set, the default is R_HOME/etc/Rprofile.site , which is used if it exists (which is not the case with a factory installation).
So Sys.getenv("R_PROFILE") for the first option or Sys.getenv("R_HOME") or R.home() for the second option. On macOS, the location of the second /Library/Frameworks/R.framework/Resources/etc/ is /Library/Frameworks/R.framework/Resources/etc/ .
The file may not exist, or you can see the following commented out lines:
# set a CRAN mirror # local({r <- getOption("repos") # r["CRAN"] <- "http://my.local.cran" # options(repos=r)})
Therefore, unmark the comments and change " http: //my.local.cran " to the correct website, for example:
local({r <- getOption("repos") r["CRAN"] <- "http://cran.r-project.org" options(repos=r)})
rinni Dec 12 '11 at 13:40 2011-12-12 13:40
source share