For those in a hurry: packagefinder in one minute

  • packagefinder is made to search for packages on CRAN.
  • Install it with install.packages("packagefinder", dependencies = TRUE).
  • Use the findPackage() function (or its shortcut fp()) to search for packages o CRAN.
  • Assume, you want to search packages with the search terms "meta" and "regression" in their name, title or description; then you can query CRAN with findPackage like this: findPackage(c("meta", "regression"), mode = "and").
  • Alternatively, you can phrase your query simply as findPackage("meta and regression").
  • Results can be displayed in the console (argument display = "console"), the viewer (display = "console", if you are using R Studio), or your web browser (display = "browser"), my favorite. So, fp("meta and regression", display = "browser") is all you need to to search CRAN for all packages relevant for meta regression and show the results as a webpage.
  • Apart from findPackage(), packagefinder provides even more features to learn about packages: Use whatsNew() to find out what’s new on CRAN; if you want to learn more on a specific package, query it with packageDetails(), e.g. packageDetails("ggplot2") to find out more.

A bit more into the details: What is packagefinder? How does it benefit me?

Currently, there are more than 15,000 R package contributions on CRAN providing R with an unparalleled wealth of features. The downside of the large and increasing amount of packages is that it becomes increasingly difficult to find the right tools to tackle a specific problem. Unfortunately, CRAN itself does not provide any good search functionality.

packagefinder is designed to search for CRAN packages right from the R console. The philosophy behind this package is that R users like using the R console and need a tool to do their day-to-day-work on CRAN without leaving their normal workspace, the console. In fact, the idea is that with packagefinder you do not need to leave the R console to work with CRAN effectively.

packagefinder is developed to save you time and energy finding the right packages to work with, thereby making your work with R more productive.

Working with packagefinder: Search indices

packagefinder works with a CRAN search index. Most packagefinder functions have an optional index argument that allows you to provide a search index.

If you do not want to provide you own index, you can let packagefinder build a search index for you on-the-fly. This procedure is quick and does the trick, so you do not really have to care for the search index at all.

This search index, however, will not include download figures. If you want download figures to be included in the search results, you need to build a search index yourself by calling the buildIndex() function, for example like this:

buildIndex(filename = "myindex.rdata", download.stats = TRUE)

buildIndex() not only returns the search index so that you can immediately work with it but it also able to save the index to a file, depending on the optional filename argument.

Please note that building a search index with download stats included can take some time (an hour or so) because download figures are requested for each of the several thousand R packages individually. A progress bar informs you about the current state of things while your index is being built.

Searching CRAN for packages

Using findPackage()

The basics

It is easy to search for packages on CRAN with findPackage(). Its main arguments are a vector of keywords you are looking for, keywords, and the search mode, mode. The mode determines if your keywords will be linked together with AND or OR (default is "OR").

So, a simple search for all packages covering meta regression topics, for example, may look like this:

findPackage(c("meta", "regression"), "and")

Alternatively you can also simply execute:

findPackage("meta and regression")

or

findPackage("meta AND regression")

in the console (the logical operators are not case-sensitive). If you write a query like this, the keywords argument is ignored. Currently, the first logical operator is used for all ‘sub-queries’, so

findPackage(c("meta AND regression", "model OR heterogeneity"))

in fact searches for meta AND regression AND model and heterogeneity. This behavior may change in future versions of packagefinder.