1% File src/library/utils/man/setRepositories.Rd
2% Part of the R package, https://www.R-project.org
3% Copyright 1995-2015 R Core Team
4% Distributed under GPL 2 or later
5
6\name{setRepositories}
7\alias{setRepositories}
8\title{Select Package Repositories}
9\description{
10  Interact with the user to choose the package repositories to be used.
11}
12\usage{
13setRepositories(graphics = getOption("menu.graphics"),
14                ind = NULL, addURLs = character())
15}
16\arguments{
17  \item{graphics}{Logical. If true, use a graphical list: on Windows or
18    macOS GUI use a list box, and on a Unix-alike if \pkg{tcltk} and an X
19    server are available, use Tk widget. Otherwise use a text
20    \code{\link{menu}}.}
21  \item{ind}{\code{NULL} or a vector of integer indices, which have the
22    same effect as if they were entered at the prompt for
23    \code{graphics = FALSE}.}
24  \item{addURLs}{A character vector of additional URLs: it is often
25    helpful to use a named vector.}
26}
27\details{
28  The default list of known repositories is stored in the file
29  \file{\var{\link{R_HOME}}/etc/repositories}.
30  That file can be edited for a site, or a user can have a personal copy
31  in the file pointed to by the environment variable
32  \env{R_REPOSITORIES}, or if this is unset or does not exist,
33  in \file{\var{HOME}/.R/repositories}, which will take precedence.
34
35  A Bioconductor mirror can be selected by setting
36  \code{\link{options}("BioC_mirror")}, e.g.\sspace{}via
37  \code{\link{chooseBioCmirror}} --- the default value is
38  \samp{"https://bioconductor.org"}.
39
40  The items that are preselected are those that are currently in
41  \code{options("repos")} plus those marked as default in the
42  list of known repositories.
43
44  The list of repositories offered depends on the setting of option
45  \code{"pkgType"} as some repositories only offer a subset of types
46  (e.g., only source packages or not macOS binary packages).
47  Further, for binary packages some repositories (notably R-Forge) only
48  offer packages for the current or recent versions of \R.
49  (Type \code{"both"} is equivalent to \code{"source"}.)
50
51  Repository \samp{CRAN} is treated specially: the value is taken from
52  the current setting of \code{getOption("repos")} if this has an
53  element \code{"CRAN"}: this ensures mirror selection is sticky.
54
55  This function requires the \R session to be interactive unless
56  \code{ind} is supplied.
57}
58\note{
59  This does \strong{not} set the list of repositories at startup: to do
60  so set \code{\link{options}(repos =)} in a start up file (see help topic
61  \link{Startup}).
62}
63\value{
64  This function is invoked mainly for its side effect of updating
65  \code{options("repos")}.  It returns (invisibly) the previous
66  \code{repos} options setting (as a \code{\link{list}} with component
67  \code{repos}) or \code{\link{NULL}} if no changes were applied.
68}
69\seealso{
70  \code{\link{chooseCRANmirror}}, \code{\link{chooseBioCmirror}},
71  \code{\link{install.packages}}.
72}
73\examples{\dontrun{
74setRepositories(addURLs =
75                c(CRANxtras = "https://www.stats.ox.ac.uk/pub/RWin"))
76}}
77\keyword{ utilities }
78