# NOT RUN {
# The missing argument can be useful to generate calls
quo(f(x = !! missing_arg()))
quo(f(x = !! NULL))
# It is perfectly valid to generate and assign the missing
# argument.
x <- missing_arg()
l <- list(missing_arg())
# 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(missing_arg())
#> missing(l[[1]])
# while is_missing() will work as expected:
is_missing(missing_arg())
is_missing(l[[1]])
# }
Run the code above in your browser using DataLab