List Available Packages at CRAN-like Repositories
available.packages returns a matrix of details corresponding to
packages currently available at one or more repositories. The
current list of packages is downloaded over the internet (or copied
from a local mirror).
available.packages(contriburl = contrib.url(repos, type), method, fields = NULL, type = getOption("pkgType"), filters = NULL, repos = getOption("repos"))
- URL(s) of the
contribsections of the repositories. Specify this argument only if your repository mirror is incomplete, e.g., because you burned only the contribsection on a CD.
- download method, see
- character string, indicate which type of packages: see
type = "both"this will use the source repository.
- a character vector giving the fields to extract from
PACKAGESfile(s) in addition to the default ones, or
NULL(default). Unavailable fields result in
- a character vector or list or
- character vector, the base URL(s) of the repositories to use.
The list of packages is either copied from a local mirror (specified by a
file:// URI) or downloaded. If downloaded, the list is cached
for the Rsession in a per-repository file in
with a name like
By default, the return value includes only packages whose version and OS requirements are met by the running version of R, and only gives information on the latest versions of packages.
filters can be used to select which of the packages on the
repositories are reported. It is called with its default value
NULL) by functions such as
install.packages: this value
c("R_version", "OS_type", "subarch", "duplicates") if
that is unset or set to
The built-in filters are
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
If all the filters are from this set, then they can be specified as a
character vector; otherwise
filters should be a list with
elements which are character strings, user-defined functions or
add = TRUE (see below).
User-defined filters are functions which take a single argument, a
matrix of the form returned by
return a matrix consisting of a subset of the rows of the argument.
add = TRUE appends the other
elements of the filter list to the default filters.
- A matrix with one row per package, row names the package names and
column names including
"Repository". Additional columns can be specified using the
Where provided by the repository, fields
"NeedsCompilation"are reported for use by the filters and package management tools, including
## Restrict install.packages() (etc) to known-to-be-FOSS packages options(available_packages_filters = c("R_version", "OS_type", "subarch", "duplicates", "license/FOSS")) ## or options(available_packages_filters = list(add = TRUE, "license/FOSS")) ## Give priority to released versions on CRAN, rather than development ## versions on Omegahat, R-Forge etc. options(available_packages_filters = c("R_version", "OS_type", "subarch", "CRAN", "duplicates"))