Skip to contents

Functions to check the call stack and get aspects of previous calls. Used in putting together object histories and error handling.

Usage

get_prev_call(toplevel = 1L)

get_prev_fname(toplevel = 3L)

get_args(toplevel = 2L, verbose = FALSE)

get_args_list(toplevel = 1L, keep = NULL, ...)

Arguments

toplevel

integer. Relative stack where the function call was made.

verbose

be verbose

keep

character. When NULL, all params are captured. If not NULL, specifies which params to capture.

...

additional params to capture

Value

character

Functions

  • get_prev_call(): Get previous call

  • get_prev_fname(): Get previous call function name

  • get_args(): Get previous call args as named character vector

  • get_args_list(): Get call args as named list

Examples

a <- function(x = 1, y = 2, ...) {
    get_args_list(...)
}

a(z = 3, keep = "y")
#> $y
#> [1] 2
#> 
#> $z
#> [1] 3
#>