Re: [R] Capturing Function Arguments

2024-02-19 Thread Reed A. Cartwright
Thanks Ivan and Iris for your solutions, I'll look over them. The solution that I came up with last night involves creating a function that has the same formals signature as the wrapped function and relying on `environment()` and `list(...)` to return a function's variables at the beginning of the

Re: [R] Capturing Function Arguments

2024-02-18 Thread Ivan Krylov via R-help
В Sat, 17 Feb 2024 11:15:43 -0700 "Reed A. Cartwright" пишет: > I'm wrapping a function in R and I want to record all the arguments > passed to it, including default values and missing values. This is hard if not impossible to implement for the general case because the default arguments are eval

Re: [R] Capturing Function Arguments

2024-02-18 Thread Iris Simmons
Hi Reed, I need to stress before giving my answer that no solution can handle everything. These scenarios will always lead to problems: * if any of the formal arguments rely on the current state of the call stack * if any of the formal arguments rely on a variable that is only defined later in

[R] Capturing Function Arguments

2024-02-18 Thread Reed A. Cartwright
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