Better get()

better_get(x, pos = -1L, mode = "any", inherits = TRUE, ...)

Arguments

pos, mode, inherits

arguments passed to base::get(). Note that argument envir is not passed to base::get(), since it is typically defined dynamically by that function.

...

additional arguments are passed to base::get(). The only additional argument is envir which is not recommended, but is here for compatibility with the base functionality.

character

string with an R object name, with or without an R package prefix. Note that only one value is recognized.

Value

the R object found. If not object is found an error results.

Examples

get("get", pos="package:base")
#> function (x, pos = -1L, envir = as.environment(pos), mode = "any", #> inherits = TRUE) #> .Internal(get(x, envir, mode, inherits)) #> <bytecode: 0x7fd202e1da58> #> <environment: namespace:base>
better_get("base::get")
#> function (x, pos = -1L, envir = as.environment(pos), mode = "any", #> inherits = TRUE) #> .Internal(get(x, envir, mode, inherits)) #> <bytecode: 0x7fd202e1da58> #> <environment: namespace:base>