Title: | Comfortable Search for R Packages on CRAN, Either Directly from the R Console or with an R Studio Add-in |
---|---|
Description: | Search for R packages on CRAN directly from the R console, based on the packages' titles, short and long descriptions, or other fields. Combine multiple keywords with logical operators ('and', 'or'), view detailed information on any package and keep track of the latest package contributions to CRAN. If you don't want to search from the R console, use the comfortable R Studio add-in. |
Authors: | Joachim Zuckarelli [aut, cre] |
Maintainer: | Joachim Zuckarelli <[email protected]> |
License: | GPL-3 |
Version: | 0.3.2 |
Built: | 2024-11-06 02:40:09 UTC |
Source: | https://github.com/jsugarelli/packagefinder |
Builds a search index that can be used with findPackage()
.
buildIndex(filename = "", download.stats = FALSE)
buildIndex(filename = "", download.stats = FALSE)
filename |
Name of .rdata file to which the new index is saved. |
download.stats |
Indicates if the search index shall include download figures from the RStudio CRAN mirror logs. |
Functions like findPackage()
or go()
require a search index. This search index can either be created on-the-fly or be provided as a separate argument. In the latter case a search index can be built using buildIndex()
. This index can include download figures for the packages
(this feature is turned on with download.stats = TRUE
). Including download stats requires significant time (may well be > 1 hour) for the index to be built. Therefore, when findPackage()
is called without
providing an index, the index that is created on-the-fly does not contain CRAN download figures.
Returns the search index. As a side effect, the index is saved to a file, if a filename is provided via the filename
argument.
Joachim Zuckarelli [email protected]
index <- buildIndex(filename = file.path(tempdir(), "searchindex.rdata"), download.stats = FALSE)
index <- buildIndex(filename = file.path(tempdir(), "searchindex.rdata"), download.stats = FALSE)
Searches for packages on CRAN by scanning a specified set of information fields for a user-provided search term.
exploreFields( term, fields = c("Name", "Description", "LongDescription"), mode = "or", match = "like", display = "viewer", index = NULL )
exploreFields( term, fields = c("Name", "Description", "LongDescription"), mode = "or", match = "like", display = "viewer", index = NULL )
term |
Search term to look for; character vector must have one element. |
fields |
The list of fields to be scanned for the search term; must be a character vector with one or more field names. Allowed field names are: |
mode |
Indicates whether matches in the field shall be combined with a logical OR or with a logical AND; accordingly, permitted values are |
match |
Either |
display |
Describes where the search results shall be shown. Either |
index |
Either a path (or URL) to a search index, or a search index that is already loaded. If no index is provided, |
Found packages are listed in alphabetical order, there is no prioritization of search hits as in findPackage()
.
No return value.
Joachim Zuckarelli [email protected]
exploreFields("Hadley", c("Maintainer", "Authors@R", "Author"))
exploreFields("Hadley", c("Maintainer", "Authors@R", "Author"))
Searches for packages on CRAN based on the user's specification of search terms. Considers the package name, description as well as the long description, and prioritizes the results.
findPackage( keywords = NULL, query = NULL, mode = "or", case.sensitive = FALSE, always.sensitive = NULL, weights = c(2, 2, 1, 2), display = "viewer", results.longdesc = FALSE, limit.results = 15, silent = FALSE, index = NULL, advanced.ranking = TRUE, return.df = FALSE, clipboard = FALSE )
findPackage( keywords = NULL, query = NULL, mode = "or", case.sensitive = FALSE, always.sensitive = NULL, weights = c(2, 2, 1, 2), display = "viewer", results.longdesc = FALSE, limit.results = 15, silent = FALSE, index = NULL, advanced.ranking = TRUE, return.df = FALSE, clipboard = FALSE )
keywords |
A vector of keywords to be searched for. Instead of separate search terms, |
query |
A vector of regular expressions (regex) to match against package name and descriptions; alternative to |
mode |
Indicates whether the search terms in |
case.sensitive |
Indicates if the search shall be case sensitive, or not. |
always.sensitive |
A vector of search terms for which capitalization is always considered relevant (even if |
weights |
A numeric vector describing how search hits in different fields of the a package's data shall be weighted. The first three elements of the vector are the weights assigned to hits in the package's title, short description and long description, respectively. The fourth element is a factor applied to the overall score of a search hit if all search terms from the |
display |
Describes where the search results shall be shown. Either |
results.longdesc |
Indicates whether the packages' long descriptions shall also be included in the search results. Given the length of some long decsriptions this may make the search results harder to read. |
limit.results |
The maximum number of matches presented in the search results; choose a negative number to display all results |
silent |
Indicates whether any visible output is produced. Use |
index |
Either a path (or URL) to a search index, or a search index that is already loaded. If no index is provided, |
advanced.ranking |
Indicates if the ranking of search results shall be based on weights taking into account the inverse frequencies of the different search terms across all packages and the length of the matches relative to the texts they were found in. Usually, using advanced ranking ( |
return.df |
If |
clipboard |
If |
The GO
column in the search results is an index number that can be used to address the found package easily with the go()
function.
The Total Downloads
column in the search results gives the overall number of downloads of the respective package since its submission to CRAN. The number is based on the figures for the RStudio CRAN mirror server.
This field is only provided if the search index contains download figures. Ad hoc indices (when index = NULL
) never include download statistics. Please refer to buildIndex()
for more details.
fp()
is a shorter alias for findPackage()
.
The search results as a dataframe, if df.return = TRUE
.
Joachim Zuckarelli [email protected]
search <- c("regression", "meta") findPackage(search) findPackage(c("text", "tables")) searchindex <- buildIndex() findPackage(keywords=c("regression", "linear"), mode="and", always.sensitive="GLM", index=searchindex) findPackage("meta and regression", display="console") # Alternatively, show results in browser # findPackage("meta and regression", display="browser") my.results <- findPackage("meta AND regression")
search <- c("regression", "meta") findPackage(search) findPackage(c("text", "tables")) searchindex <- buildIndex() findPackage(keywords=c("regression", "linear"), mode="and", always.sensitive="GLM", index=searchindex) findPackage("meta and regression", display="console") # Alternatively, show results in browser # findPackage("meta and regression", display="browser") my.results <- findPackage("meta AND regression")
Shorter alias for function findPackage()
.
fp(...)
fp(...)
... |
Arguments as in |
Joachim Zuckarelli [email protected]
fp(c("meta", "regression"))
fp(c("meta", "regression"))
Allows to inspect a package found with findPackage()
by showing detailed CRAN information on the package, opening its manual (PDF) or pulling up the package's website. Also allows to install the package right away.
go(package, where.to = "details", index = NULL)
go(package, where.to = "details", index = NULL)
package |
Either the name of the package (capitalization does generally not matter) or the search result number shown in the results of |
where.to |
Either |
index |
Either a path (or URL) to a search index, or a search index that is already loaded. If no index is provided, |
go()
is made to inspect a package found with findPackage()
and to decide whether or not this package serves the intended purposes.
No return value.
Joachim Zuckarelli [email protected]
Shows the results of the last search with findPackage()
.
lastResults(display = "viewer")
lastResults(display = "viewer")
display |
Describes where the search results shall be shown. Either |
No return value.
Joachim Zuckarelli [email protected]
Shows detailed CRAN information for a package.
packageDetails(package, brief = FALSE, show.tip = TRUE, index = NULL)
packageDetails(package, brief = FALSE, show.tip = TRUE, index = NULL)
package |
Either the name of a package (capitalization does generally not matter) or the search result number shown in the results of |
brief |
If |
show.tip |
If |
index |
Either a path (or URL) to a search index, or a search index that is already loaded. If no index is provided, |
No return value.
Joachim Zuckarelli [email protected]
packageDetails("ggplot2")
packageDetails("ggplot2")
Comfortable search for R packages on CRAN directly from the R console
Currently, there are more than 16,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 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.
Contact the author:
E-mail: Joachim Zuckarelli ([email protected])
Twitter: @jsugarelli
packagefinder introduction: A Quick Tutorial
packagefinder on GitHub: https://github.com/jsugarelli/packagefinder
packagefinder video tutorial on YouTube: https://youtu.be/B96NMSo3nJI (discusses version 0.1.5)
Shows information on the latest package additions to CRAN.
whatsNew(last.days = 0, brief = TRUE, index = NULL)
whatsNew(last.days = 0, brief = TRUE, index = NULL)
last.days |
The length of the period (in days) for which package additions to CRAN shall be presented. |
brief |
Determines if all avalilable package description fields shall be shown ( |
index |
Either a path (or URL) to a search index, or a search index that is already loaded. If no index is provided, |
Number of packages covered by the period specified in last.days
.
Joachim Zuckarelli [email protected]
whatsNew(last.days = 3)
whatsNew(last.days = 3)