get0: Backport of get0 for R < 3.2.0

Description Usage Examples

View source: R/get0.R

Description

See the original description in base::get0.

Usage

1
2
3
4
5
6
7
get0(
  x,
  envir = pos.to.env(-1L),
  mode = "any",
  inherits = TRUE,
  ifnotfound = NULL
)

Examples

1
2
3
4
5
6
7
8
9
# get function from namespace instead of possibly getting
# implementation shipped with recent R versions:
bp_get0 = getFromNamespace("get0", "backports")

bp_get0("a")
bp_get0("a", ifnotfound = 0)

foo = 12
bp_get0("foo")

Example output

NULL
[1] 0
[1] 12

backports documentation built on Dec. 13, 2021, 5:08 p.m.