rlang v0.2.0


Monthly downloads



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

A toolbox for working with base types, core R features like the condition system, and core 'Tidyverse' features like tidy evaluation.



Build Status Coverage Status

Important: The rlang API is still maturing. Please see ?rlang::lifecycle for the list of functions that are considered stable.


The rlang package provides tools to work with core language features of R and the tidyverse:

  • The tidy eval framework, which is a well-founded system for non-standard evaluation built on quasiquotation (!!) and quosures (quo()).

  • Consistent tools for working with base types. Note that overall this is a work in progress that is still in flux:

    • Vectors, including construction (lgl(), int(), ...) coercion (as_logical(), as_character(), ...), and predicates (is_logical(), is_character()).

    • Language objects, such as calls (lang()) and symbols (sym()).

    • Attributes, e.g. set_names().

    • Functions, e.g. new_function(), as_function(). The latter supports the purrr-style formula notation for lambda functions.

    • Environments, e.g. env(), env_has(), env_get(), env_bind(), env_unbind().

  • A comprehensive set of predicates to determine if an object satisfies various conditions, e.g. has_length(), is_list(), is_empty().

  • The condition (message, warning, error) and restart system.


You can install the released version of rlang from CRAN with:


Or install the development version from github with:

# install.packages("devtools")
devtools::install_github("r-lib/rlang", build_vignettes = TRUE)

Functions in rlang

Name Description
are_na Test for missing values
call_fn Extract function from a call
call_inspect Inspect a call
dots_definitions Capture definition objects
dots_n How many arguments are currently forwarded in dots?
dots_values Evaluate dots with preliminary splicing
eval_tidy Evaluate an expression with quosures and pronoun support
eval_bare Evaluate an expression in an environment
flatten Flatten or squash a list of lists into a simpler vector
duplicate Duplicate an R object
fn_body Get or set function body
frame_position Find the position or distance of a frame on the evaluation stack
is_function Is object a function?
friendly_type Format a type for error messages
is_true Is object identical to TRUE or FALSE?
is_frame Is object a frame?
lang Create a call
missing_arg Generate or handle a missing argument
op-null-default Default value for NULL
op-na-default Replace missing values
modify Modify a vector
quo_expr Squash a quosure
quo_label Format quosures for printing or labelling
as_data_mask Create a data mask
scalar-type-predicates Scalar type predicates
as_env Coerce to an environment
scoped_bindings Temporarily change bindings of an environment
set_chr_encoding Set encoding of a string or character vector
call2 Create a call
call_args Extract arguments from a call
set_expr Set and get an expression
as_environment Coerce to an environment
type-predicates Type predicates
catch_cnd Catch a condition
arg_match Match an argument to a character vector
as_function Convert to function or closure
chr_unserialise_unicode Translate unicode points to UTF-8
as_quosure Coerce object to quosure
as_bytes Coerce to a raw vector
type_of Base type of an object
bare-type-predicates Bare type predicates
as_utf8_character Coerce to a character vector and attempt encoding conversion
box Box a value
env_bury Mask bindings by defining symbols deeper in a scope
env_clone Clone an environment
env_names Names of symbols bound in an environment
call_standardise Standardise a call
env_parent Get parent environments
deprecated-cnd Deprecated condition constructors
fn_env Return the closure environment of a function
as_pairlist Coerce to pairlist
as_overscope Create an overscope
dictionary Create a dictionary
caller_env Get the environment of the caller frame
call_modify Modify the arguments of a call
call_name Extract function name of a call
fn_fmls Extract arguments from a function
cnd Create a condition object
cnd_signal Signal a condition
empty_env Get the empty environment
env Create a new environment
env_bind Bind symbols to objects in an environment
eval_tidy_ Tidy evaluation in a custom environment
env_bind_exprs Bind lazy or active bindings
exiting Create an exiting or in place handler
expr_interp Process unquote operators in a captured expression
env_has Does an environment have or see bindings?
env_inherits Does environment inherit from another environment?
expr_label Turn an expression to a label
is_call Is object a call?
invoke Invoke a function with a list of arguments
is_installed Is a package installed in the library?
expr_print Print an expression
env_depth Depth of an environment chain
env_get Get an object in an environment
is_integerish Is a vector integer-like?
has_name Does an object have an element with this name?
is_copyable Is an object copyable?
exprs_auto_name Ensure that list of expressions are all named
inherits_any Does an object inherit from a set of classes?
is_empty Is object an empty vector or NULL?
is_stack Is object a stack?
is_lang Is object a call?
is_symbol Is object a symbol?
names2 Get names of a vector
new-vector-along Create vectors matching the length of a given vector
f_rhs Get or set formula components
env_unbind Remove bindings from an environment
env_poke Poke an object in an environment
is_condition Is object a condition?
new_node Helpers for pairlist and language nodes
is_callable Is an object callable?
f_text Turn RHS of formula into a string or label
is_formula Is object a formula?
is_expression Is an object an expression?
ns_env Get the namespace of a package
is_namespace Is an object a namespace environment?
quo_squash Squash a quosure
quosure Quosure getters, setters and testers
is_named Is object named?
rst_list Restarts utilities
parse_quosures Parse R code
new-vector Create vectors matching a given length
new_call Create a new call from components
overscope_eval_next Evaluate next quosure in a data mask
mut_utf8_locale Set the locale's codeset for testing
mut_node_car Mutate node components
get_env Get or set the environment of an object
is_pairlist Is object a node or pairlist?
rst_muffle Jump to a muffling restart
seq2 Increasing sequence of integers in an interval
has_length How long is an object?
is_env Is object an environment?
missing Missing values
is_expr Is an object an expression?
lifecycle Life cycle of the rlang package
with_env Evaluate an expression within a given environment
vector-construction Create vectors
set_attrs Add attributes to an object
op-get-attr Infix attribute accessor
op-definition Definition operator
vector-old-ctors Retired vector construction by length
parse_quosure Parse text into a quosure
restarting Create a restarting handler
prepend Prepend a vector
scoped_env Scoped environments
quotation Quotation
scoped_options Change global options
stack_trim Trim top call layers from the evaluation stack
stack Call stack information
set_names Set names of a vector
is_quosureish Test for or coerce to quosure-like objects
is_reference Is an object referencing another?
with_handlers Establish handlers on the stack
splice Splice lists
tidy-dots Collect dots tidily
vec_poke_n Poke values into a vector
lang_head Return the head or tail of a call
vector-coercion Coerce an object to a base type
new_formula Create a formula
lang_modify Manipulate or access a call
tidyeval-data Data pronoun for tidy evaluation
new_function Create a function
return_from Jump to or from a frame
prim_name Name of a primitive function
quasiquotation Quasiquotation of an expression
rst_abort Jump to the abort restart
string Create a string
with_restarts Establish a restart point on the stack
switch_lang Dispatch on call type
switch_type Dispatch on base types
sym Create a symbol or list of symbols
abort Signal an error, warning, or message
No Results!

Last month downloads


License GPL-3
LazyData true
ByteCompile true
RoxygenNote 6.0.1
URL http://rlang.tidyverse.org, https://github.com/r-lib/rlang
BugReports https://github.com/r-lib/rlang/issues
NeedsCompilation yes
Packaged 2018-02-20 06:15:49 UTC; lionel
Repository CRAN
Date/Publication 2018-02-20 10:07:47 UTC

Include our badge in your README