Learn R Programming

⚠️There's a newer version (1.1.4) of this package.Take me there.

rlang

Overview

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

  • Tidy evaluation.
  • Base types: vectors, expressions, and environments.
  • Call and context stacks.
  • The condition system.

Installation

rlang is not automatically installed with the tidyverse package, but you can install it with:

install.packages("rlang")
library("rlang")

Or install the development version from github with:

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

Copy Link

Version

Install

install.packages('rlang')

Monthly Downloads

1,820,374

Version

0.1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

June 4th, 2024

Functions in rlang (0.1)

as_env

Coerce to an environment
as_function

Convert to function or closure
arg_match

Match an argument to a character vector
as_bytes

Coerce to a raw vector
as_overscope

Create a dynamic scope for tidy evaluation
as_pairlist

Coerce to pairlist
abort

Signal an error, warning, or message
are_na

Test for missing values
dots_n

How many arguments are currently forwarded in dots?
dots_values

Evaluate dots with preliminary splicing
dictionary

Create a dictionary
dots_list

Extract dots with splicing semantics
env_bury

Overscope bindings by defining symbols deeper in a scope
env_clone

Clone an environment
env_depth

Depth of an environment chain
env_get

Get an object from an environment
eval_tidy

Evaluate an expression tidily
eval_tidy_

Tidy evaluation in a custom environment
exiting

Create an exiting or in place handler
expr

Raw quotation of an expression
get_env

Get or set the environment of an object
has_length

How long is an object?
is_env

Is object an environment?
duplicate

Duplicate an R object
empty_env

Get the empty environment
env

Create a new environment
env_bind

Bind symbols to objects in an environment
caller_env

Get the environment of the caller frame
cnd_signal

Signal a condition
env_has

Does an environment have or see bindings?
env_inherits

Does environment inherit from another environment?
has_name

Does an object have an element with this name?
invoke

Invoke a function with a list of arguments
is_callable

Is an object callable?
is_condition

Is object a condition?
env_unbind

Remove bindings from an environment
eval_bare

Evaluate an expression in an environment
f_text

Turn RHS of formula into a string or label
flatten

Flatten or squash a list of lists into a simpler vector
is_formula

Is object a formula?
is_frame

Is object a frame?
lang

Create a call
is_expr

Is an object an expression?
is_named

Is object named?
is_pairlist

Is object a node or pairlist?
lang_modify

Modify the arguments of a call
lang_name

Extract function name of a call
op-na-default

Replace missing values
op-null-default

Default value for NULL
expr_interp

Process unquote operators in a captured expression
expr_label

Turn an expression to a label
fn_env

Return the closure environment of a function
lang_args

Extract arguments from a call
lang_fn

Extract function from a call
lang_head

Return the head or tail of a call object
op-definition

Definition operator
as_quosure

Coerce object to quosure
as_utf8_character

Coerce to a character vector and attempt encoding conversion
bare-type-predicates

Bare type predicates
is_quosure

Is an object a quosure or quosure-like?
is_stack

Is object a stack?
mut_utf8_locale

Set the locale's codeset for testing
names2

Get names of a vector
call_inspect

Inspect a call
env_names

Names of symbols bound in an environment
env_parent

Get parent environments
exprs_auto_name

Ensure that list of expressions are all named
f_rhs

Get or set formula components
frame_position

Find the position or distance of a frame on the evaluation stack
friendly_type

Format a type for error messages
new_cnd

Create a condition object
new_formula

Create a formula
dots_definitions

Tidy quotation of multiple expressions and dots
quasiquotation

Quasiquotation of an expression
quo-predicates

Is a quosure quoting a symbolic, missing or NULL object?
scalar-type-predicates

Scalar type predicates
scoped_env

Scoped environments
restarting

Create a restarting handler
set_chr_encoding

Set encoding of a string or character vector
is_function

Is object a function?
is_installed

Is a package installed in the library?
is_integerish

Is a vector integer-like?
is_lang

Is object a call?
fn_fmls

Extract arguments from a function
is_copyable

Is an object copyable?
is_empty

Is object an empty vector or NULL?
is_symbol

Is object a symbol?
set_expr

Set and get an expression
tidyeval-data

Data pronoun for tidy evaluation
type-predicates

Type predicates
missing_arg

Generate or handle a missing argument
modify

Modify a vector
new_function

Create a function
op-get-attr

Infix attribute accessor
prepend

Prepend a vector
prim_name

Name of a primitive function
type_of

Base type of an object
vector-along

Create vectors matching the length of a given vector
vector-len

Create vectors matching a given length
with_env

Evaluate an expression within a given environment
seq2

Increasing sequence of integers in an interval
set_attrs

Add attributes to an object
switch_type

Dispatch on base types
sym

Create a symbol or list of symbols
ns_env

Get the namespace of a package
quo_expr

Splice a quosure and format it into string or label
quosure

Create quosures
rst_list

Restarts utilities
rst_muffle

Jump to a muffling restart
string

Create a string
switch_lang

Dispatch on call type
vector-coercion

Coerce an object to a base type
vector-construction

Create vectors
is_true

Is object identical to TRUE or FALSE?
lang_standardise

Standardise a call
missing

Missing values
pairlist

Helpers for pairlist and language nodes
parse_expr

Parse R code
return_from

Jump to or from a frame
rst_abort

Jump to the abort restart
set_names

Set names of a vector
splice

Splice a list within a vector
stack

Call stack information
stack_trim

Trim top call layers from the evaluation stack
with_handlers

Establish handlers on the stack
with_restarts

Establish a restart point on the stack