Skip to contents

Better get()

Usage

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: 0x000001df653bc428>
#> <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: 0x000001df653bc428>
#> <environment: namespace:base>