Skip to content

Commit

Permalink
fixing some call_modify examples w/ NULL -> zap()
Browse files Browse the repository at this point in the history
Some examples in call_modify() predate the introduction of zap() and use the older `[arg] = NULL` syntax.  In particular, this made line 560's example, `call_modify(call, bar = NULL, bar = missing_arg())`, no longer illustrate its key behavior.  Changed that, plus 2 other (likely less important) examples where argument removal seems to have been intended.
  • Loading branch information
jmobrien authored Dec 12, 2024
1 parent 471cf69 commit 63a4de1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/call.R
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ call_has_precedence <- function(call, parent_call, side = NULL) {
#' call_modify(call, na.rm = )
#'
#' # Supply a list of new arguments with `!!!`
#' newargs <- list(na.rm = NULL, trim = 0.1)
#' newargs <- list(na.rm = zap(), trim = 0.1)
#' call <- call_modify(call, !!!newargs)
#' call
#'
Expand Down Expand Up @@ -557,11 +557,11 @@ call_has_precedence <- function(call, parent_call, side = NULL) {
#' # subtle implications, for instance you can move an argument to
#' # last position by removing it and remapping it:
#' call <- quote(foo(bar = , baz))
#' call_modify(call, bar = NULL, bar = missing_arg())
#' call_modify(call, bar = zap(), bar = missing_arg())
#'
#' # You can also choose to keep only the first or last homonym
#' # arguments:
#' args <- list(bar = NULL, bar = missing_arg())
#' args <- list(bar = zap(), bar = missing_arg())
#' call_modify(call, !!!args, .homonyms = "first")
#' call_modify(call, !!!args, .homonyms = "last")
call_modify <- function(.call,
Expand Down

0 comments on commit 63a4de1

Please sign in to comment.