Understanding how an environment works

In the previous sections, you learned about lazy evaluation, copy-on-modify, and lexical scoping. These mechanisms are highly related to a type of object called environment. In fact, lexical scoping is enabled exactly by the environment. Although environments look quite similar to lists, they are indeed fundamentally different in several aspects. In the following sections, we will get to know the behavior of environment objects by creating and manipulating them, and see the way its structure determines how R functions work.

Knowing the environment object

An environment is an object consisting of a set of names and has a parent environment. Each name (also known as a symbol or variable) points to an object. ...

Get Learning R Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.