Learn R Programming

pryr (version 0.1.6)

parenv: Get parent/ancestor environment

Description

Get parent/ancestor environment

Usage

parenv(env = parent.frame(), n = 1)

Arguments

env

an environment

n

number of parents to go up

Examples

Run this code
adder <- function(x) function(y) x + y
add2 <- adder(2)
parenv(add2)

Run the code above in your browser using DataLab