I have a function that internally calls another function that can have missing arguments. If I do not define a default NULL value for the argument in the high-level function the missing argument is correctly passed down. However, in the function documentation, I would like to explicitly indicate that the argument is optional by assigning a default NULL value to it.
In the following MWE, how could I make high.foo2() work more like high.foo1()?
low.foo <- function(y = NULL) if(missing(y)) cat ('y is missing') else print(y)
high.foo1 <- function(y) low.foo(y = y)
high.foo1()
# > y is missing
high.foo2 <- function(y = NULL) low.foo(y = y)
high.foo2()
# > NULL
PD1. Not a duplicate of R how to pass a (potentially) missing argument?