# 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")
Run the code above in your browser using DataLab