# The missing argument can be useful to generate calls
tidy_quote(f(x = !! arg_missing()))
tidy_quote(f(x = !! NULL))
# It is perfectly valid to generate and assign the missing
# argument.
x <- arg_missing()
l <- list(arg_missing())
# Note that accessing a missing argument contained in a list does
# not trigger an error:
l[[1]]
is.null(l[[1]])
# But if the missing argument is assigned in the current
# environment, it is no longer possible to touch it. The following
# lines would all return errors:
#> x
#> is.null(x)
# In these cases, you can use maybe_missing() to manipulate an
# object that might be the missing argument without triggering a
# missing error:
maybe_missing(x)
is.null(maybe_missing(x))
is_missing(maybe_missing(x))
# base::missing() does not work well if you supply an
# expression. The following lines would throw an error:
#> missing(arg_missing())
#> missing(l[[1]])
# while is_missing() will work as expected:
is_missing(arg_missing())
is_missing(l[[1]])
Run the code above in your browser using DataLab