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

Overview

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

  • The tidyeval framework, which is a well-founded system for non-standard evaluation built on quasiquotation (UQ()) and quosures (quo()). Read more in vignette("tidy-evaluation").

  • Consistent tools for working with base types:

    • 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_attrs(), set_names().

    • Functions, e.g. new_function(), as_function(), is_function().

    • 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.

  • Call and context stacks.

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("devtools")
devtools::install_github("tidyverse/rlang", build_vignettes = TRUE)

News

rlang 0.1.6

  • This is a maintenance release in anticipation of a forthcoming change to R's C API (use MARK_NOT_MUTABLE() instead of SET_NAMED()).

  • New function is_reference() to check whether two objects are one and the same.

rlang 0.1.4

  • eval_tidy() no longer maps over lists but returns them literally. This behaviour is an overlook from past refactorings and was never documented.

rlang 0.1.2

This hotfix release makes rlang compatible with the R 3.1 branch.

rlang 0.1.1

This release includes two important fixes for tidy evaluation:

  • Bare formulas are now evaluated in the correct environment in tidyeval functions.

  • enquo() now works properly within compiled functions. Before this release, constants optimised by the bytecode compiler couldn't be enquoted.

New functions:

  • The new_environment() constructor creates a child of the empty environment and takes an optional named list of data to populate it. Compared to env() and child_env(), it is meant to create environments as data structures rather than as part of a scope hierarchy.

  • The new_language() constructor creates calls out of a callable object (a function or an expression) and a pairlist of arguments. It is useful to avoid costly internal coercions between lists and pairlists of arguments.

UI improvements:

  • env_child()'s first argument is now .parent instead of parent.

  • mut_ setters like mut_attrs() and environment helpers like env_bind() and env_unbind() now return their (modified) input invisibly. This follows the tidyverse convention that functions called primarily for their side effects should return their input invisibly.

  • is_pairlist() now returns TRUE for NULL. We added is_node() to test for actual pairlist nodes. In other words, is_pairlist() tests for the data structure while is_node() tests for the type.

Bugfixes:

  • env() and env_child() can now get arguments whose names start with .. Prior to this fix, these arguments were partial-matching on env_bind()'s .env argument.

  • The internal replace_na() symbol was renamed to avoid a collision with an exported function in tidyverse. This solves an issue occurring in old versions of R prior to 3.3.2 (#133).

rlang 0.1.0

Initial release.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("rlang")

0.2.0 by Lionel Henry, 3 months ago


http://rlang.tidyverse.org, https://github.com/r-lib/rlang


Report a bug at https://github.com/r-lib/rlang/issues


Browse source code at https://github.com/cran/rlang


Authors: Lionel Henry [aut, cre], Hadley Wickham [aut], RStudio [cph]


Documentation:   PDF Manual  


GPL-3 license


Suggests crayon, knitr, methods, pillar, rmarkdown, testthat, covr


Imported by CGPfunctions, DiagrammeR, ESTER, GGally, GSODR, InjurySeverityScore, MlBayesOpt, NPMOD, PKNCA, PKPDmisc, REddyProc, RSDA, RmarineHeatWaves, RtutoR, SWMPrExtension, VWPre, amt, anomalize, assertr, attempt, auk, ballr, banR, bayesammi, bayesplot, baystability, bioinactivation, bioset, blastula, blorr, bupaR, cancensus, clustree, coalitions, codebook, comperes, condformat, cutpointr, cytominer, dbplot, dbplyr, descriptr, detrendr, dexter, dlookr, dotwhisker, dplyr, drake, driftR, dynprog, edeaR, estimatr, etl, evaluator, fabricatr, facerec, fbar, fold, foolbox, forcats, formulize, furrr, ggalluvial, ggeffects, ggformula, gghighlight, ggpmisc, ggquickeda, ggstatsplot, googleAnalyticsR, googledrive, harrietr, healthcareai, hms, iadf, idealstan, ijtiff, implyr, infer, inferr, influxdbr, ipumsr, janitor, jpmesh, jpndistrict, keyholder, kokudosuuchi, konfound, later, markmyassignment, metacoder, metaplot, modeldb, modelr, moderndive, mosaicCore, mrgsolve, msigdbr, mudata2, mvMonitoring, nandb, naniar, ncmeta, nofrills, nonmemica, normalr, nyctaxi, oec, olsrr, openair, padr, particles, photobiology, pillar, pivot, pkgdown, pmatch, pointblank, polypoly, poppr, prisonbrief, processanimateR, processmapR, profile, promises, proustr, psychmeta, purrr, qualtRics, quantable, quickReg, qwraps2, rbgm, rclimateca, recipes, replyr, rfm, rhmmer, riingo, rsample, rubias, ruler, sabre, scatterpie, scriptName, sealr, seplyr, shiny, sjPlot, sjlabelled, sjmisc, sjstats, skimr, sparklyr, spdplyr, srvyr, stability, statar, stplanr, styler, sugrrants, tabularaster, tailr, tatoo, taxa, testthat, textfeatures, tfdatasets, tfestimators, tfruns, tibble, tibbletime, tidyLPA, tidyboot, tidygraph, tidyhydat, tidyimpute, tidyinftheo, tidyposterior, tidypredict, tidyquant, tidyr, tidyselect, tidystringdist, tidytext, tidyverse, tsibble, uncmbb, unjoin, unpivotr, valr, vdiffr, wordbankr, xpose, yardstick.

Suggested by enc, listarrays, sf, tidyxl.


See at CRAN