Skip to contents

The Stan values for allowed_packages, export_index, and origin_map are generated by data_raw/sysdata.R.

Usage

scan_usage(
  path = ".",
  ignore_unqualified_functions = .stdlib_funs,
  strict = FALSE,
  skip_dirs = .scan_skip_dirs,
  allowed_packages = .stan_pkgs,
  export_index = .stan_export_index,
  origin_map = .stan_origin_map
)

Arguments

path

A single project directory (searched recursively) or a vector of files (.R/.Rmd/.qmd).

ignore_unqualified_functions

Character vector of function names to ignore when attributing (unqualified) calls to Stan packages. Defaults to exports from base R packages listed in stdlib_funs(). Calls like rstan::plot() will NOT be ignored even if plot is in ignore_unqualified_functions.

strict

If TRUE, only count unqualified function calls that resolve to a single Stan package.

skip_dirs

Character vector of directory names to skip when scanning a directory. Defaults to .scan_skip_dirs.

allowed_packages

Character vector of package namespaces to attribute to Stan usage. Defaults to .stan_pkgs.

export_index

Named list mapping function names to packages. Defaults to .stan_export_index.

origin_map

Named character vector mapping pkg::fun keys to the origin package. Defaults to .stan_origin_map.

Value

A list of packages, resolved functions, and ambiguous function calls.

Details

Unqualified function calls are only attributed when a Stan package is attached via library() or require() in the same file. Known reexports are remapped to their origin packages; missing mappings fall back to the resolved package.