From 1ca50df3fb4db66db4b6f2de037a49d46cbbb302 Mon Sep 17 00:00:00 2001 From: andrie Date: Sun, 24 Mar 2024 18:23:01 +0000 Subject: [PATCH] Change default of `available.packages` to `filters=NULL` #153 --- R/pkgDep.R | 11 +++++++---- man/pkgAvail.Rd | 5 ++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/R/pkgDep.R b/R/pkgDep.R index d63d7c9..59c2425 100644 --- a/R/pkgDep.R +++ b/R/pkgDep.R @@ -84,7 +84,6 @@ pkgDep <- function(pkg, availPkgs, repos = getOption("repos"), type = "source", pkgInAvail <- pkg %in% availPkgs[, "Package"] pkgInAvail <- pkg %in% availPkgNames(availPkgs) - # browser() if (sum(pkgInAvail) == 0 ) stop("No valid packages in pkg") if (sum(pkgInAvail) < length(pkg)) { warning("Package not recognized: ", paste(pkg[!pkgInAvail], collapse = ", ")) @@ -153,12 +152,16 @@ print.pkgDep <- function(x, ...) { #' repository, otherwise attempts to read from a CRAN mirror at the `repos` url. #' #' @inheritParams pkgDep +#' +#' @param filters passed to [utils::available.packages] +#' #' @export #' @family create repo functions #' @seealso [pkgDep()] pkgAvail <- function(repos = getOption("repos"), type = "source", - Rversion = R.version, quiet = FALSE) { + Rversion = R.version, quiet = FALSE, + filters = NULL) { assert_that(is_repos(repos)) if (!grepl("^https*://|file:///", repos[1]) && file.exists(repos[1])) { repos <- paste0("file:///", normalizePath(repos[1], @@ -176,7 +179,7 @@ pkgAvail <- function(repos = getOption("repos"), type = type, Rversion = Rversion), type = type, - filters = list(), + filters = filters, repos = repos ) } else { @@ -185,7 +188,7 @@ pkgAvail <- function(repos = getOption("repos"), type = type, Rversion = Rversion), type = type, - filters = list() + filters = filters ) } } diff --git a/man/pkgAvail.Rd b/man/pkgAvail.Rd index 27cbab5..332c90d 100644 --- a/man/pkgAvail.Rd +++ b/man/pkgAvail.Rd @@ -8,7 +8,8 @@ pkgAvail( repos = getOption("repos"), type = "source", Rversion = R.version, - quiet = FALSE + quiet = FALSE, + filters = NULL ) } \arguments{ @@ -28,6 +29,8 @@ installed on other platforms. Passed to \code{\link[=download.packages]{downloa }} \item{quiet}{If TRUE, suppresses warnings} + +\item{filters}{passed to \link[utils:available.packages]{utils::available.packages}} } \description{ This is a thin wrapper around \code{\link[utils:available.packages]{utils::available.packages()}}. If the argument