These functions return the head or the tail of a call. See section on calls as parse trees in lang(). They are equivalent to node_car() and node_cdr() but support quosures and check that the input is indeed a call before retrieving the head or tail (it is unsafe to do this without type checking). lang_head() returns the head of the call without any conversion, unlike lang_name() which checks that the head is a symbol and converts it to a string. lang_tail() returns the pairlist of arguments (while lang_args() returns the same object converted to a regular list)





Can be a call (language object), a formula quoting a call in the right-hand side, or a frame object from which to extract the call expression.

See also

pairlist, lang_args(), lang()


lang <- quote(foo(bar, baz)) lang_head(lang)
#> foo #> attr(,"foo") #> [1] "bar"
#> [[1]] #> bar #> #> [[2]] #> baz #>