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.

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. 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.

## Examples

# TO inspect a package at your working directory use path = "."
rev_args(pkginspector_example("viridisLite"))
#> Registered S3 method overwritten by 'pryr':
#>   method      from
#>   print.bytes Rcpp#> $arg_df #> arg_name n_functions default_consistent default_consistent_percent #> 1 n 6 FALSE 83.33333 #> 2 alpha 6 TRUE 100.00000 #> 3 begin 6 TRUE 100.00000 #> 4 end 6 TRUE 100.00000 #> 5 direction 6 TRUE 100.00000 #> 6 option 2 TRUE 100.00000 #> #>$arg_map
#>               n alpha begin  end direction option
#> cividis    TRUE  TRUE  TRUE TRUE      TRUE  FALSE
#> inferno    TRUE  TRUE  TRUE TRUE      TRUE  FALSE
#> magma      TRUE  TRUE  TRUE TRUE      TRUE  FALSE
#> plasma     TRUE  TRUE  TRUE TRUE      TRUE  FALSE
#> viridis    TRUE  TRUE  TRUE TRUE      TRUE   TRUE
#> viridisMap TRUE  TRUE  TRUE TRUE      TRUE   TRUE
#>