rev_args: Extracts the default arguments and checks for consistency

View source: R/rev_args.R

rev_argsR Documentation

Extracts the default arguments and checks for consistency

Description

From a package, get all the default arguments for the functions of said package. Then check how many times each argument is used and whether the default value for the argument is consistent across all functions where it's used. This function also returns a matrix indicating each function where the arguments are used.

Usage

rev_args(path = ".", exported_only = FALSE)

Arguments

path

Name of a source R package tar archive file, or path to the folder of an R package.

exported_only

Logical. Whether to check only the exported functions or all the functions detected by rev_calls. or all the functions detected by rev_calls.

Value

A two element list with arg_df and arg_map. The arg_df is a data.frame with one element per argument that has the name of the argument, the number of functions where it's used, whether the default is consistent across all functions and percent of consistency (based on the first appearance of the argument). arg_map is a logical matrix with the functions in the rows and the arguments in the columns. It specifies which functions use which arguments.

Author(s)

Leonardo Collado-Torres https://github.com/lcolladotor

Examples

# TO inspect a package at your working directory use `path = "."`
rev_args(pkginspector_example("viridisLite"))

ropenscilabs/pkginspector documentation built on May 15, 2022, 5:30 a.m.