Minimal Implementation of Functional Lenses

Provides utilities to create and use lenses to simplify data manipulation. Lenses are composable getter/setter pairs that provide a functional approach to manipulating deeply nested data structures, e.g., elements within list columns in data frames. The implementation is based on the earlier 'lenses' R package < https://github.com/cfhammill/lenses>, which was inspired by the Haskell 'lens' package by Kmett (2012) < https://github.com/ekmett/lens>, one of the most widely referenced implementations of lenses. For additional background and history on the theory of lenses, see the 'lens' package wiki: < https://github.com/ekmett/lens/wiki/History-of-Lenses>.


tinylens

R-CMD-check

The goal of tinylens is to provide a minimal set of tools for working with lenses in R.

As of the initial release, this is basically a re-implementation of the lenses package (https://github.com/cfhammill/lenses).

Installation

You can install the development version of tinylens from GitHub with:

# install.packages("pak")
pak::pak("arbelt/tinylens")

Example

The main benefit of lenses is that they are composable, and so allow for more streamlined transformations of nested data structures.

library(tinylens)
## basic example code

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("tinylens")

0.1.0 by Albert Wang, 2 years ago


https://github.com/arbelt/tinylens


Report a bug at https://github.com/arbelt/tinylens/issues


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


Authors: Albert Wang [aut, cre, cph]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports rlang, S7, vctrs

Suggests tidyselect, tinytest


See at CRAN