Learn R Programming

tinylens (version 0.1.0)

view: View the focused part of a data structure

Description

view() applies a lens to a data structure and returns the focused part.

set() applies a lens to a data structure and sets the focused part.

over() applies a lens to a data structure and modifies the focused part using a function.

Usage

view(d, l)

Value

The part of the data structure focused by the lens

Arguments

d

The data structure to view

l

The lens to apply

Examples

Run this code
x <- 1:10
names(x) <- letters[1:10]
view(x, names_l)
set(x, names_l, LETTERS[1:10])
over(x, names_l, toupper)

Run the code above in your browser using DataLab