Hi,
I want to create an if statement for the case if an input variable is ignored to specify in a function (so create a default value to an input). Minimalist example is enclosed.
Thank you for your help in advance,
Marcell
test_fun <- function(a, b) {
if (!exists(b, mode = "function")) {
b = 3
return(a + b)
}
}
test_fun(a = 3)
#> Error in exists(b, mode = "function"): argument "b" is missing, with no default
Created on 2020-08-22 by the reprex package (v0.3.0)