Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

call_name

Extract function name or namespace of a call


Description

Extract function name or namespace of a call

Usage

call_name(call)

call_ns(call)

Arguments

call

Can be a call or a quosure that wraps a call.

Value

A string with the function name, or NULL if the function is anonymous.

Life cycle

In rlang 0.2.0, lang_name() was deprecated and renamed to call_name(). See lifecycle section in call2() for more about this change.

See Also

Examples

# Extract the function name from quoted calls:
call_name(quote(foo(bar)))
call_name(quo(foo(bar)))

# Namespaced calls are correctly handled:
call_name(~base::matrix(baz))

# Anonymous and subsetted functions return NULL:
call_name(quote(foo$bar()))
call_name(quote(foo[[bar]]()))
call_name(quote(foo()()))

# Extract namespace of a call with call_ns():
call_ns(quote(base::bar()))

# If not namespaced, call_ns() returns NULL:
call_ns(quote(bar()))

rlang

Functions for Base Types and Core R and 'Tidyverse' Features

v0.4.11
MIT + file LICENSE
Authors
Lionel Henry [aut, cre], Hadley Wickham [aut], mikefc [cph] (Hash implementation based on Mike's xxhashlite), Yann Collet [cph] (Author of the embedded xxHash library), RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.