call_modify

0th

Percentile

Modify the arguments of a call.

Modify the arguments of a call.

Usage
call_modify(.call = NULL, ..., .args = list(), .env = NULL)
Arguments
.call
Can be a call, a formula quoting a call in the right-hand side, or a frame object from which to extract the call expression. If not supplied, the calling frame is used.
..., .args
Named expressions (constants, names or calls) used to modify the call. Use NULL to remove arguments.
.env
Environment in which to look up call the function definition and the contents of .... If not supplied, it is retrieved from call if the latter is a frame object or a formula.
See Also

new_call

Aliases
  • call_modify
Examples
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 .args
newargs <- list(na.rm = NULL, trim = 0.1)
call_modify(call, .args = newargs)

# If the call is missing, the parent frame is used instead.
f <- function(bool = TRUE) call_modify(.args = list(bool = FALSE))
f()
Documentation reproduced from package rlang, version 0.0.0.9000, License: GPL-3

Community examples

Looks like there are no examples yet.