Package 'pkgapi'

Title: Map Function Calls
Description: Create the map of function calls in a package, including calls to imported packages.
Authors: Gábor Csárdi
Maintainer: Gábor Csárdi <[email protected]>
License: MIT + file LICENSE
Version: 1.0.0
Built: 2024-12-26 03:42:30 UTC
Source: https://github.com/r-lib/pkgapi

Help Index


Roclet: make API file.

Description

This roclet automates the production of an API file that describes the exported interface of a package.

Usage

api_roclet()

Create the function call map of an R package

Description

Find all functions and function calls in a package. This requires the loading of the package (in another R session, so the current R session is unaffected by this), which means that all depended and imported packages must be available as well.

Usage

map_package(path = ".")

Arguments

path

path to an R package root

Value

List with elements:

  • name: package name,

  • exports: character vector of exported funtions and operators.

  • defs: data frame of function definitions.

  • calls: data frame of function calls.

Columns in defs:

  • name: function name,

  • file: file path where it was defined, relative to the package root.

  • line1: line of start position of function definition.

  • col1: column of start position.

  • line2: line of end position.

  • col2: column of end position.

  • exported: whether the function is exported or not.

Columns in calls:

  • file: file path of the call, relative to the package root.

  • from: name of calling function, or empty string if called from outside of a function.

  • to: called function, in the package::function form.

  • type: call type, regular functions calls are call.

  • line1: line of the beginning of the call.

  • col1: column of the beginning of the call.

  • line1: line of the end of the call.

  • col2: column of the beginning of the call.

  • str: the actual code, text of the function call, usually just the called function's name.


Map Function Calls

Description

Create the map function calls in a package, including calls to imported packages.