Static Detection and Citation of R Package and Function Usage

Scans R source files for package and function use, then builds citations from configurable package universes. Supports .R, .Rmd, and .qmd files, resolves unqualified calls by attachment order and re-export origin, and leaves each package collection to define its own citations. See 'stanflow' < https://github.com/VisruthSK/stanflow> for an example usage.


ascribe

R-CMD-check Codecov test coverage

ascribe scans R projects for package and function use. Other packages can use the results to generate citations without maintaining their own parser.

Installation

You can install the development version of ascribe from GitHub with:

# install.packages("pak")
pak::pak("VisruthSK/ascribe")

Example

Build a package universe, then cite the code that uses it:

library(ascribe)

universe <- build_universe_data("stats")
usage <- scan_usage(path, universe)
cite_usage(usage)

Limitations

  • The scanner records function calls, not function references. It ignores lapply(x, mean) and purrr::map(x, sd).
  • Its built-in Markdown parser recognizes R chunks headed with {r}. Plain fenced blocks with an r info string are skipped.
  • Package attachments are tracked within each file. A setup script that calls library() does not establish attachment state for another file.
  • Default package citations require the package to be installed. Supply package_citations for packages that are unavailable locally.
  • Scanning a namespace inspects its bindings for R6 classes. Active bindings can run their getters, and unusually deep generated expressions can exceed R's recursion limits.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("ascribe")

0.2.0 by Visruth Srimath Kandali, 2 months ago


https://ascribe.visruth.com


Report a bug at https://github.com/VisruthSK/ascribe/issues


Browse source code at https://github.com/cran/ascribe


Authors: Visruth Srimath Kandali [aut, cre, cph] (ORCID:


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports brio, cli, fastmatch

Suggests knitr, quarto, spelling, testthat


See at CRAN