[Rd] setRepositories: name argument
Lluís Revilla
||u|@@rev|||@ @end|ng |rom gm@||@com
Tue Aug 4 12:48:14 CEST 2026
Hi all,
setRepositories has a name argument to select repositories. I've been
exploring how to use it and I'd like to share some comments with you:
The documentation says: "NULL or character vector of names of the
repositories in the repository table which has the same effect as passing
the corresponding indices to ind.". I understood it was the graphical names
saved as menu_name on R.home()/etc/repositories, but those aren't accepted:
Instead users need to use the row names of the matrix.
A change in the documentation could clarify which name it refers to.
However, I would prefer if the argument would accept the menu_name and
users could select repositories with names matching the
graphical/interactive menu: setRepositories(name = c("CRAN", "BioC
software")) instead of setRepositories(name = c("CRAN", "BioCSoft")).
It can be hard to know which are the names of the repositories a user
should use. I see that R checks the R_REPOSITORIES system environment
variable to find them (utils:::.get_repositories). A helper to
get repository names would be appreciated, it would make it easier to check
before setting them.
In addition, when setting repositories with setRepositories(ind = 1:99)
there is no error or warning for selecting more repositories than
available, but setting repositories by name, for example
setRepositories(name = c("CRAN", "XYZ")), fails with an error. I think that
any repository requested but not available should be a warning (and not an
error in the case of name argument), or at least the behaviour between both
parameters be consistent.
Of the CRAN packages that use setRepositories I could find, most (all) use
ind instead of name to set the repositories. If the order of the
repositories change or some checks performed on CRAN do not have the same
repositories by default, using names and having a way to check which
repositories are available would make it easier to use the repositories
configuration file and pass those checks without trouble.
Cheers,
Lluís
PS: Using setRepositories(ind = 1:99) works the first time but any
subsequent call will fail with "Error in aa[aa == ""] <- repos[new][aa ==
""] : NAs are not allowed in subscripted assignments".
[[alternative HTML version deleted]]
More information about the R-devel
mailing list