search for: makemiss

Displaying 2 results from an estimated 2 matches for "makemiss".

Did you mean: akemi's
2024 Feb 18
1
Capturing Function Arguments
...defaults to NULL). I think the key here is evaluating the arguments first, then matching. This makes a lot of assumptions about the function being inspected: no NSE, no ellipsis, formals don't depend on the body, nothing weird about the environment of the function... f <- function(...) { .makemissing <- function() alist(a=)$a .ismissing <- function(x) identical(x, .makemissing()) # prepare to evaluate formals params <- formals(f0) e <- new.env(parent = environment(f0)) # assign non-missing formals for (n in names(params)) if (!.ismissing(params[[n]])) eval( # work around...
2024 Feb 17
2
Capturing Function Arguments
I'm wrapping a function in R and I want to record all the arguments passed to it, including default values and missing values. I want to be able to snoop on function calls in sourced scripts as part of a unit testing framework. I can capture the values fine, but I'm having trouble evaluating them as if `force()` had been applied to each of them. Here is a minimal example: f0 <-