This is like base::search but when used inside a function, it will show the full scope (see figure in the section Binding environments on http://adv-r.had.co.nz/Environments.html). This full search path will be potentially much longer than just search() (which always starts at .GlobalEnv).

searchFullEx shows an example function that is inside this package whose only function is to show the Scope of a package function.

searchFull(env = parent.frame(), simplify = TRUE)

searchFullEx()

Arguments

env

The environment to start searching at. Default is calling environment, i.e., parent.frame()

simplify

Logical. Should the output be simplified to character, if possible (usually it is not possible because environments don't always coerce correctly)

Value

A list of environments that is the actual search path, unlike search() which only prints from .GlobalEnv up to base through user attached packages.

Details

searchFullEx can be used to show an example of the use of searchFull.

See also

Examples

seeScope <- function() {
  searchFull()
}
seeScope()
#> [[1]]
#> <environment: 0x55ebd74a6af8>
#> 
#> [[2]]
#> <environment: 0x55ebd7380b28>
#> 
#> [[3]]
#> <environment: 0x55ebd734c728>
#> 
#> [[4]]
#> <environment: 0x55ebcd7ad900>
#> 
#> [[5]]
#> <environment: R_GlobalEnv>
#> 
#> [[6]]
#> [1] "package:reproducible"
#> 
#> [[7]]
#> [1] "package:stats"
#> 
#> [[8]]
#> [1] "package:graphics"
#> 
#> [[9]]
#> [1] "package:grDevices"
#> 
#> [[10]]
#> [1] "package:utils"
#> 
#> [[11]]
#> [1] "package:datasets"
#> 
#> [[12]]
#> [1] "package:methods"
#> 
#> [[13]]
#> [1] "Autoloads"
#> 
#> [[14]]
#> <environment: base>
#> 
searchFull()
#> [[1]]
#> <environment: 0x55ebd7380b28>
#> 
#> [[2]]
#> <environment: 0x55ebd734c728>
#> 
#> [[3]]
#> <environment: 0x55ebcd7ad900>
#> 
#> [[4]]
#> <environment: R_GlobalEnv>
#> 
#> [[5]]
#> [1] "package:reproducible"
#> 
#> [[6]]
#> [1] "package:stats"
#> 
#> [[7]]
#> [1] "package:graphics"
#> 
#> [[8]]
#> [1] "package:grDevices"
#> 
#> [[9]]
#> [1] "package:utils"
#> 
#> [[10]]
#> [1] "package:datasets"
#> 
#> [[11]]
#> [1] "package:methods"
#> 
#> [[12]]
#> [1] "Autoloads"
#> 
#> [[13]]
#> <environment: base>
#> 
searchFullEx()
#> [[1]]
#> <environment: namespace:reproducible>
#> 
#> [[2]]
#> [1] "imports:reproducible"
#> 
#> [[3]]
#> <environment: namespace:base>
#> 
#> [[4]]
#> <environment: R_GlobalEnv>
#> 
#> [[5]]
#> [1] "package:reproducible"
#> 
#> [[6]]
#> [1] "package:stats"
#> 
#> [[7]]
#> [1] "package:graphics"
#> 
#> [[8]]
#> [1] "package:grDevices"
#> 
#> [[9]]
#> [1] "package:utils"
#> 
#> [[10]]
#> [1] "package:datasets"
#> 
#> [[11]]
#> [1] "package:methods"
#> 
#> [[12]]
#> [1] "Autoloads"
#> 
#> [[13]]
#> <environment: base>
#>