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: 0x56527442ba28>
#> 
#> [[2]]
#> <environment: 0x56527433b560>
#> 
#> [[3]]
#> <environment: 0x5652743103f8>
#> 
#> [[4]]
#> <environment: 0x56526aa3a130>
#> 
#> [[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: 0x56527433b560>
#> 
#> [[2]]
#> <environment: 0x5652743103f8>
#> 
#> [[3]]
#> <environment: 0x56526aa3a130>
#> 
#> [[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>
#>