browse_cran: Search for CRAN packages by keyword/regex

Description Usage Arguments Details Value Examples

View source: R/exported_functions.R

Description

Inspired by my mysterious inability to remember what the RColorBrewer package is actually called. Lets you find relevant CRAN packages right from your terminal.

Usage

1
browse_cran(query, fuzzy = FALSE, echo = TRUE, ignore.case = TRUE)

Arguments

query

(Character) A string to grep() for.

fuzzy

(Logical) If TRUE, enables fuzzy orderless matching. Every word in query (i.e. every group of characters separated with a space) will be wrapped with a lookaround (?=*KEYWORD). This will match keywords regardless of the order in which those words appear.

echo

(Logical) If TRUE, print the results to the console.

ignore.case

(Logical) If TRUE, ignore upper/lowercase differences while searching.

Details

When browse_cran() is run for the first time in a new session, it will take about 6-12 seconds to download and cache CRAN data. This only happens once per session; subsequent calls will use the cached copy.

Value

Invisibly returns a dataframe of the packages that matched the query together with their descriptions. Prints results to the console.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
browse_cran("colorbrewer")  # Search by keyword

#> RColorBrewer 
#>     Provides color schemes for maps (and other graphics) designed by Cynthia 
#>     Brewer as described at http://colorbrewer2.org 
#> 
#> Redmonder 
#>     Provide color schemes for maps (and other graphics) based on the color 
#>     palettes of several Microsoft(r) products.


browse_cran("zero-inflat.*?(abund|count)")  # Search by regular expression

#> hurdlr 
#>     When considering count data, it is often the case that many more zero 
#>     counts than would be expected of some given distribution are observed.

# And five other matches...


browse_cran("network twitter api", fuzzy = TRUE)  # Order-agnostic (fuzzy) search

#> RKlout 
#>     An interface of R to Klout API v2.

DesiQuintans/librarian documentation built on July 16, 2021, 2:25 a.m.