
Identify R functions best matching a given input string
Source:R/similar-fns.R
pkgmatch_similar_fns.Rd
Function matching is only available for functions from the corpus of rOpenSci packages. Function matching is also based on LM output only, and unlike package matching does not combine LM output with BM25 word-frequency matching.
Arguments
- input
A text string.
- embeddings
Large Language Model embeddings for a suite of packages, generated from pkgmatch_embeddings_from_pkgs. If not provided, pre-generated embeddings will be downloaded and stored in a local cache directory.
- n
When the result of this function is printed to screen, the top
n
packages will be displayed.- browse
If
TRUE
, automatically open webpages of the topn
matches in local browser.
Value
A modified data.frame
object of class "pkgmatch". The data.frame
has 3 columns:
"function" with the name of the function in the form "
:: "; "simil" with a similarity score between 0 and 1; and
"rank" as an integer index, with the highest rank of 1 as the first row.
The return object has a default print
method which prints the names only
of the first 5 best matching functions; see ?print.pkgmatch
for details.
See also
Other main:
pkgmatch_similar_pkgs()
Examples
if (FALSE) { # \dontrun{
input <- "Process raster satellite images"
p <- pkgmatch_similar_fns (input)
p # Default print method, lists 5 best matching packages
head (p) # Shows first 5 rows of full `data.frame` object
} # }