/rlang

Low-level API for programming with R

Primary LanguageR

rlang

Build Status AppVeyor Build Status Coverage Status Lifecycle Status

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

Overview

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 quoted arguments (enquo()). See https://tidyeval.tidyverse.org.

  • User-friendly error reporting with backtraces and chained errors (abort(), trace_back(), with_abort()).

  • A consistent API for working with base types. Note that overall this is a work in progress that is still in flux:

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

    • Calls and symbols, e.g. call2(), is_call(), sym(), syms().

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

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

    • Attributes, e.g. set_names().

Installation

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

install.packages("rlang")

Or install the development version from github with:

# install.packages("remotes")
remotes::install_github("r-lib/rlang")

Cheatsheet

tidy eval cheatsheet