s_crandb_tvdb: Search For Recent Packages In crandb And In Task View

View source: R/s_crandb_tvdb.R

s_crandb_tvdbR Documentation

Search For Recent Packages In crandb And In Task View

Description

This is a function for task view maintenance.

Search packages in a subset of crandb within dates from and to that contain one or several keywords in the columns "Package", "Title", "Description", 'Author" or "Maintainer", then verify if these packages are already refereed in one of the task views stored in tvdb.

Usage

s_crandb_tvdb(..., char = NULL, tv = "Distributions", from = -10,
  to = Sys.Date(), select = "PTD", mode = "or", sensitive = FALSE,
  perl = FALSE, fixed = FALSE, agrep = FALSE, max.distance = 0.1,
  costs = NULL, crandb = get("crandb", envir = .GlobalEnv),
  tvdb = get("tvdb", 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.

tv

character. One task view among those listed in tvdb.

from

character representing a date earlier than date to. Or a negative integer representing the number of days preceeding the date to.

to

date. The upper date in the search.

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.

tvdb

list. The list of the task views.

Value

A list with the following vectors:

  • spkgs: The selected packages that contain the keyword(s).

  • inTV: The packages that contain the keyword(s) already refereed in the task view.

  • notinTV: The packages that contain the keyword(s) not (yet) refereed in the task view.

  • inTV_in: Among the packages available in the task view, those installed in the computer.

  • inTV_un: Among the packages available in the task view, those not installed in the computer.

  • notinTV_in: Among the packages not refereed in the task view, those installed in the computer.

  • notinTV_un: Among the packages not refereed in the task view, those not installed in the computer.

Examples

### TASK VIEW MAINTENANCE (tvdb + crandb)
## In real life, download crandb and tvdb from CRAN or load them from your directory
## with functions crandb_down(), crandb_load(), tvdb_down(), tvdb_load().
## In this example, we use small files.
crandb_load(system.file("data", "zcrandb.rda", package = "RWsearch"))
tvdb_load(system.file("data", "ztvdb.rda", package = "RWsearch"))

## List the task views
tvdb_vec()

## Search for the recent packages in crandb that contain the keyword
## and verify the packages already refereed in the task view.
(lst <- s_crandb_tvdb("distribution", tv = "Distributions", from = "2018-01-01"))

if (interactive()) {
p_display7(lst[c("inTV", "notinTV")], dir = file.path(tempdir(), "scrandbtvdb"))
}

RWsearch documentation built on May 29, 2024, 6:42 a.m.