Skip to contents

See ?pkgmatch_bm25 for details of BM25 ranks. This function calculates "BM25" ranks from function-call frequencies between a local R package and all packages in specified corpus. Values are thus higher for packages with similar patterns of function calls, weighted by inverse frequencies, so functions called infrequently across the entire corpus contribute more than common functions.

Note that the results of this function are entirely different from pkgmatch_bm25 with corpus = "ropensci-fns". The latter returns BM25 values from text descriptions of all functions in all rOpenSci packages, whereas this function returns BM25 values based on frequencies of function calls within packages.

Usage

pkgmatch_bm25_fn_calls(path, corpus = NULL)

Arguments

path

Local path to source code of an R package.

corpus

One of "ropensci" or "cran"

Value

A data.frame of two columns:

  • "package" Naming the package from the specified corpus;

  • bm25 The "BM25" index value for the nominated packages, where high values indicate greater overlap in term frequencies.

See also

Other bm25: pkgmatch_bm25()

Examples

if (FALSE) { # \dontrun{
u <- "https://cran.r-project.org/src/contrib/odbc_1.5.0.tar.gz"
path <- file.path (tempdir (), basename (u))
download.file (u, destfile = path)
bm25 <- pkgmatch_bm25_fn_calls (path)
} # }