browse_cran {librarian}R Documentation

Search for CRAN packages by keyword/regex

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

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


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.



[Package librarian version 1.8.1 Index]