# NOT RUN {
call <- quote(mean(x, na.rm = TRUE))
# Modify an existing argument
call_modify(call, na.rm = FALSE)
call_modify(call, x = quote(y))
# Remove an argument
call_modify(call, na.rm = NULL)
# Add a new argument
call_modify(call, trim = 0.1)
# Add an explicit missing argument
call_modify(call, na.rm = quote(expr = ))
# Supply a list of new arguments with `!!!`
newargs <- list(na.rm = NULL, trim = 0.1)
call_modify(call, !!! newargs)
# Supply a call frame to extract the frame expression:
f <- function(bool = TRUE) {
call_modify(call_frame(), splice(list(bool = FALSE)))
}
f()
# You can also modify quosures inplace:
f <- quo(matrix(bar))
call_modify(f, quote(foo))
# }
Run the code above in your browser using DataLab