Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rebind

Rebind an existing name.


Description

This function is similar to <<- with two exceptions:

Usage

rebind(name, value, env = parent.frame())

Arguments

name

name of existing binding to re-assign

value

new value

env

environment to start search in.

Details

  • if no existing binding is found, it throws an error

  • it does not recurse past the global environment into the attached packages

Examples

a <- 1
rebind("a", 2)
a
# Throws error if no existing binding
## Not run: rebind("b", 2)

local({
  rebind("a", 3)
})
a

# Can't find get because doesn't look past globalenv
## Not run: rebind("get", 1)

pryr

Tools for Computing on the Language

v0.1.4
GPL-2
Authors
Hadley Wickham [aut, cre], R Core team [ctb] (Some code extracted from base R)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.