Skip to content

Tidy evaluation

The programmable data-masking framework developed for the tidyverse.

Tools

embrace-operator curly-curly
Embrace operator {{
glue-operators
Name injection with "{" and "{{"
dot-data .data tidyeval-data .env
.data and .env pronouns

Metaprogramming tools

injection-operator bang-bang !!
Injection operator !!
splice-operator !!!
Splice operator !!!
qq_show
Show injected expression
englue()
Defuse function arguments with glue
expr
Defuse an R expression
enquo() enquos()
Defuse function arguments
sym() syms() data_sym() data_syms()
Create a symbol or list of symbols
as_label()
Create a default name for an R object
as_name()
Extract names from symbols

Advanced tools

enexpr() exprs() enexprs() ensym() ensyms() quo() quos() enquo0() enquos0()
Advanced defusal operators
eval_tidy()
Evaluate an expression with quosures and pronoun support
as_data_mask() as_data_pronoun() new_data_mask()
Create a data mask

Function arguments

Check arguments

arg_match() arg_match0()
Match an argument to a character vector
check_exclusive()
Check that arguments are mutually exclusive
check_required()
Check that argument is supplied
missing_arg() is_missing() maybe_missing()
Generate or handle a missing argument

Check dots

check_dots_empty()
Check that dots are empty
check_dots_used()
Check that all dots have been used
check_dots_unnamed()
Check that all dots are unnamed

Collect dynamic dots

Collect arguments contained in ... with !!! and name-injection support.

dyn-dots tidy-dots doc_dots_dynamic :=
Dynamic dots features
list2() dots_list()
Collect dynamic dots in a list
pairlist2()
Collect dynamic dots in a pairlist
splice() is_spliced() is_spliced_bare()
Splice values at dots collection time

Error handling

Signal errors and other conditions

abort() warn() inform() signal() reset_warning_verbosity() reset_message_verbosity()
Signal an error, warning, or message
cnd_signal()
Signal a condition object
local_use_cli()
Use cli to format error messages

Handle errors

global_handle()
Register default global handlers
global_entrace()
Entrace unexpected errors
global_prompt_install()
Prompt user to install missing packages
try_fetch()
Try an expression with condition handlers
caller_arg
Find the caller argument for error messages
local_error_call()
Set local error call in an execution environment
args_error_context
Documentation anchor for error arguments
catch_cnd()
Catch a condition

Backtraces

Conditions

rlang_error
Errors of class rlang_error
cnd_message() cnd_header() cnd_body() cnd_footer()
Build an error message from parts
format_error_bullets()
Format bullets for error messages
cnd_inherits()
Does a condition or its ancestors inherit from a class?

Session

State

is_installed() check_installed()
Are packages installed in any of the libraries?
is_interactive() local_interactive() with_interactive()
Is R running interactively?
local_options() with_options() push_options() peek_options() peek_option()
Change global options
on_load() run_on_load() on_package_load()
Run expressions on load
faq-options
Global options for rlang

Search path and namespaces

search_envs() search_env() pkg_env() pkg_env_name() is_attached() base_env() global_env()
Search path environments
empty_env()
Get the empty environment
is_namespace()
Is an object a namespace environment?
ns_env() ns_imports_env() ns_env_name()
Get the namespace of a package
env_name() env_label()
Label of an environment

Defused expressions

parse_expr() parse_exprs() parse_quo() parse_quos()
Parse R code
expr_print() expr_deparse()
Print an expression
is_expression() is_syntactic_literal() is_symbolic()
Is an object an expression?
exprs_auto_name() quos_auto_name()
Ensure that all elements of a list of expressions are named

Evaluate

eval_tidy()
Evaluate an expression with quosures and pronoun support
eval_bare()
Evaluate an expression in an environment
exec()
Execute a function
inject()
Inject objects in an R expression

Symbols

sym() syms() data_sym() data_syms()
Create a symbol or list of symbols
is_symbol()
Is object a symbol?
as_string()
Cast symbol to string

Calls

call2()
Create a call
is_call()
Is object a call?
call_args() call_args_names()
Extract arguments from a call
call_inspect()
Inspect a call
call_match()
Match supplied arguments to function definition
call_modify()
Modify the arguments of a call
call_name() call_ns() is_call_simple()
Extract function name or namespace of a call

Quosures

Formulas

f_rhs() `f_rhs<-`() f_lhs() `f_lhs<-`() f_env() `f_env<-`()
Get or set formula components
f_text() f_name() f_label()
Turn RHS of formula into a string or label
new_formula()
Create a formula
is_formula() is_bare_formula()
Is object a formula?

Objects

Environments

env() new_environment()
Create a new environment
env_print()
Pretty-print an environment
env_parent() env_tail() env_parents()
Get parent environments
env_depth()
Depth of an environment chain
get_env() set_env() env_poke_parent()
Get or set the environment of an object
env_clone() env_coalesce()
Clone or coalesce an environment
env_inherits()
Does environment inherit from another environment?
is_environment() is_bare_environment()
Is object an environment?
as_environment()
Coerce to an environment
current_call() current_fn() current_env() caller_call() caller_fn() caller_env() frame_call() frame_fn()
Get properties of the current or caller frame
env_browse() env_is_browsed()
Browse environments
env_is_user_facing()
Is frame environment user facing?

Stack

Environment bindings

env_bind() env_bind_lazy() env_bind_active() `%<~%`
Bind symbols to objects in an environment
env_unbind()
Remove bindings from an environment
env_poke()
Poke an object in an environment
env_cache()
Cache a value in an environment
local_bindings() with_bindings()
Temporarily change bindings of an environment
env_has()
Does an environment have or see bindings?
env_get() env_get_list()
Get an object in an environment
env_names() env_length()
Names and numbers of symbols bound in an environment

Functions

new_function()
Create a function
as_function() is_lambda()
Convert to function
is_function() is_closure() is_primitive() is_primitive_eager() is_primitive_lazy()
Is object a function?
fn_fmls() fn_fmls_names() fn_fmls_syms() `fn_fmls<-`() `fn_fmls_names<-`()
Extract arguments from a function
fn_body() `fn_body<-`()
Get or set function body
fn_env() `fn_env<-`()
Return the closure environment of a function
as_closure()
Transform to a closure

S3

inherits_any() inherits_all() inherits_only()
Does an object inherit from a set of classes?
zap() is_zap()
Create zap objects
as_bytes() parse_bytes()
Human readable memory sizes
new_box() is_box() unbox()
Box a value
as_box() as_box_if()
Convert object to a box
done() is_done_box()
Box a final value for early termination

Attributes

set_names()
Set names of a vector
names2() `names2<-`()
Get names of a vector
has_name()
Does an object have an element with this name?
is_named() is_named2() have_name()
Is object named?
zap_srcref()
Zap source references

Vectors

lgl() int() dbl() cpl() chr() bytes()
Create vectors
list2() dots_list()
Collect dynamic dots in a list
rep_along() rep_named()
Create vectors matching the length of a given vector
seq2() seq2_along()
Increasing sequence of integers in an interval

Type predicates

Weak references

is_weakref()
Is object a weak reference?
new_weakref()
Create a weak reference
wref_key() wref_value()
Get key/value from a weak reference object

Operators

`%||%`
Default value for NULL
`%|%`
Replace missing values
`%@%` `%@%<-`()
Infix attribute accessor and setter