Skip to content

This tree display focusses on the distinction between names and values. For each reference-type object (lists, environments, and optional character vectors), it displays the location of each component. The display shows the connection between shared references using a locally unique id.

Usage

ref(..., character = FALSE)

Arguments

...

One or more objects

character

If TRUE, show references from character vector in to global string pool

See also

Other object inspectors: ast(), sxp()

Examples

x <- 1:100
ref(x)
#> [1:0x5566ce93ad48] <int> 

y <- list(x, x, x)
ref(y)
#>  [1:0x5566d082db48] <list> 
#> ├─[2:0x5566ce93ad48] <int> 
#> ├─[2:0x5566ce93ad48] 
#> └─[2:0x5566ce93ad48] 
ref(x, y)
#> [1:0x5566ce93ad48] <int> 
#>  
#>  [2:0x5566d082db48] <list> 
#> ├─[1:0x5566ce93ad48] 
#> ├─[1:0x5566ce93ad48] 
#> └─[1:0x5566ce93ad48] 

e <- new.env()
e$e <- e
e$x <- x
e$y <- list(x, e)
ref(e)
#>  [1:0x5566ce18d778] <env> 
#> ├─x = [2:0x5566ce93ad48] <int> 
#> ├─y =  [3:0x5566d079a3c8] <list> 
#> │     ├─[2:0x5566ce93ad48] 
#> │     └─[1:0x5566ce18d778] 
#> └─e = [1:0x5566ce18d778] 

# Can also show references to global string pool if requested
ref(c("x", "x", "y"))
#> [1:0x5566d06f8528] <chr> 
ref(c("x", "x", "y"), character = TRUE)
#>  [1:0x5566d06de8f8] <chr> 
#> ├─[2:0x5566ca937700] <string: "x"> 
#> ├─[2:0x5566ca937700] 
#> └─[3:0x5566caa2f9e0] <string: "y">