s_crandb: Search Packages by Keywords in data.frame crandb

View source: R/s_crandb.R

s_crandbR Documentation

Search Packages by Keywords in data.frame crandb

Description

The most important functions in this package along with p_down.

Search packages in data.frame crandb that contain one or several keywords in the columns "Package", "Title", "Description", "Author" or "Maintainer".

s_crandb returns a vector of the packages that contain the keywords.

s_crandb_list returns a list where each element of the list is one of the keywords.

s_crandb_PTD returns a list split by results in columns "Package", "Title" and "Description". Option mode = "and", "relax" is ignored.

s_crandb_AM returns a list split by results in columns "Author" and "Maintainer". Option mode = "and", "relax" is ignored.

Use p_table2 to print the results of s_crandb and s_crandb_list in the console. Use p_text to send the results in txt, md or pdf files. Use p_display to visualize the results in html pages in the browser.

Usage

s_crandb(..., char = NULL, select = "PTD", mode = "or",
  sensitive = FALSE, perl = FALSE, fixed = FALSE, agrep = FALSE,
  max.distance = 0.1, costs = NULL, crandb = get("crandb", envir =
  .GlobalEnv))

s_crandb_list(..., char = NULL, select = "PTD", mode = "or",
  sensitive = FALSE, perl = FALSE, fixed = FALSE, agrep = FALSE,
  max.distance = 0.1, costs = NULL, crandb = get("crandb", envir =
  .GlobalEnv))

s_crandb_PTD(..., char = NULL, mode = "or", sensitive = FALSE,
  perl = FALSE, fixed = FALSE, agrep = FALSE, max.distance = 0.1,
  costs = NULL, crandb = get("crandb", envir = .GlobalEnv))

s_crandb_AM(..., char = NULL, mode = "or", sensitive = FALSE,
  perl = FALSE, fixed = FALSE, agrep = FALSE, max.distance = 0.1,
  costs = NULL, crandb = get("crandb", envir = .GlobalEnv))

Arguments

...

any format recognized by cnsc, except list. One or several keywords.

char

(name to) a character vector. Use this argument if ... fails or if you call the function from another function. If used, argument ... is ignored.

select

character vector. A sub-vector of colnames(crandb). The short form "P", "T", "D", "PT", "PD", "TD", "PTD", "A", "M", "AM" describing the Package name, Title, Description, Author, Maintainer or a combination of them is accepted.

mode

character among "or", "and", "relax". The search mode. "relax" is for 3 words and more. It is an intermediate between "or" and "and" as it requires just 2 matching words: ("word1" AND "word2") OR ("word1" AND "word3") OR ("word1" AND "word3").

sensitive

logical. TRUE forces the search to be case sensitive.

perl

logical. Used only if fixed = FALSE. TRUE uses Perl-compatible regex. FALSE uses default regexps.

fixed

logical. TRUE matchs the keywords as is (and sensitive is forced to TRUE). FALSE allows grep or Perl regexps. See grep. Not used by agrep.

agrep

logical. For approximate matching, use agrep function rather than grep.

max.distance

integer or numeric. See agrep.

costs

NULL or list. See agrep.

crandb

data.frame crandb.

Examples

## In real life, download crandb from CRAN or load it from your directory
## with functions crandb_down() or crandb_load().
## In this example, we use a small file.
crandb_load(system.file("data", "zcrandb.rda", package = "RWsearch"))

## Search using standard or non-standard content
s_crandb(c("thermodynamic", "chemical reaction", "distillation"))
s_crandb_list(thermodynamic, "chemical reaction", distillation)

## Search using the various options
s_crandb("^f", select = "P")
s_crandb(pH, sensitive = TRUE)
s_crandb_PTD(pH, sensitive = TRUE)
s_crandb_PTD("C++", fixed = TRUE)
s_crandb(search, find, cran, web, select = "PD", mode = "and")
s_crandb(search, find, cran, web, select = "PD", mode = "relax")
s_crandb(search, find, cran, web, select = "PD", mode = "or")

## Search for some authors using the various options
s_crandb_AM(Kiener, Dutang, ORPHANED)

## Non-standard content can be unquoted words or objects in .GlobalEnv
## They are transformed into character or are evaluated
## Here, the searched keywords are "find" and "search".
OTHER <- "search"
(lst <- s_crandb_list(find, OTHER, select = "P", sensitive = TRUE))

## Display in the browser this list of packages
if (interactive()) {
p_display5(lst, dir = file.path(tempdir(), "scrandb"))
}


RWsearch documentation built on March 18, 2022, 5:17 p.m.