call2 {rlang} | R Documentation |
Language objects are (with symbols) one of the two types of symbolic objects in R. These symbolic objects form the backbone of expressions. They represent a value, unlike literal objects which are their own values. While symbols are directly bound to a value, language objects represent function calls, which is why they are commonly referred to as calls.
call2()
creates a call from a function name (or a literal
function to inline in the call) and a list of arguments.
call2(.fn, ..., .ns = NULL)
.fn |
Function to call. Must be a callable object: a string, symbol, call, or a function. |
... |
Arguments to the call either in or out of a list. These dots support tidy dots features. |
.ns |
Namespace with which to prefix |
In rlang 0.2.0 lang()
was soft-deprecated and renamed to
call2()
.
In early versions of rlang calls were called "language" objects in
order to follow the R type nomenclature as returned by
base::typeof()
. The goal was to avoid adding to the confusion
between S modes and R types. With hindsight we find it is better to
use more meaningful type names.
call_modify
# fn can either be a string, a symbol or a call call2("f", a = 1) call2(quote(f), a = 1) call2(quote(f()), a = 1) #' Can supply arguments individually or in a list call2(quote(f), a = 1, b = 2) call2(quote(f), splice(list(a = 1, b = 2))) # Creating namespaced calls: call2("fun", arg = quote(baz), .ns = "mypkg")