On Wed, 12 Jun 2024 at 16:35, Kurt Hornik <Kurt.Hornik at wu.ac.at> wrote:
So in available.packages() I could replace
? ? if (is.null(fields))
? ? ? ? fields <- requiredFields
? ? else {
? ? ? ? stopifnot(is.character(fields))
? ? ? ? fields <- unique(c(requiredFields, fields))
? ? }
? ? if(is.null(fields))
? ? ? ? fields <- getOption("available_packages_fields")
? ? if(is.null(fields))
? ? ? ? fields <- requiredFields
? ? else {
? ? ? ? stopifnot(is.character(fields))
? ? ? ? fields <- unique(c(requiredFields, fields))
? ? }
Hi all,
I have recently been researching how available.packages and
install.packages filter packages from repositories with additional
Currently there are some default filters, but users (and R admins) can
up their own filters by passing a list to the fields argument or adding
them to the "available_packages_filters" option.
But if the fields used by the filters are not read by default, then
must manually add the required fields to each call to
This makes it difficult to use new fields and to control what is
in highly regulated systems which want to use more fields to select
Current workarounds considered are:
? 1) The filtering function requiring new fields intercepts the call to
available.packages and adds the desired fields via eval in
parent.environment and then adds the filters again.
? 2) Import new data (remote or local) when filtering packages, merge
and filter accordingly.
? 3) Suggestions?
The first solution is complicated, while the second doesn't use the R
machinery of tools::write_PACKAGES to set up the repository with all
fields (although how to add more fields to the repository file is a
different issue).
Would it be possible to add a new option to add fields to be read by
available.packages, similar to filters?
The same approach for fields as for filters would avoid the two
mentioned. To match it, the new option could be named
"available_packages_fields".
I look forward to hearing from you,
? ? ? ?[[alternative HTML version deleted]]