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.
ref(..., character = FALSE)x <- 1:100
ref(x)
#> [1:0x5564efb42c20] <int>
y <- list(x, x, x)
ref(y)
#> █ [1:0x5564f05e0fd8] <list>
#> ├─[2:0x5564efb42c20] <int>
#> ├─[2:0x5564efb42c20]
#> └─[2:0x5564efb42c20]
ref(x, y)
#> [1:0x5564efb42c20] <int>
#>
#> █ [2:0x5564f05e0fd8] <list>
#> ├─[1:0x5564efb42c20]
#> ├─[1:0x5564efb42c20]
#> └─[1:0x5564efb42c20]
e <- new.env()
e$e <- e
e$x <- x
e$y <- list(x, e)
ref(e)
#> █ [1:0x5564efe6fdf0] <env>
#> ├─x = [2:0x5564efb42c20] <int>
#> ├─y = █ [3:0x5564ecf072c8] <list>
#> │ ├─[2:0x5564efb42c20]
#> │ └─[1:0x5564efe6fdf0]
#> └─e = [1:0x5564efe6fdf0]
# Can also show references to global string pool if requested
ref(c("x", "x", "y"))
#> [1:0x5564ecef78e8] <chr>
ref(c("x", "x", "y"), character = TRUE)
#> █ [1:0x5564ecf5f638] <chr>
#> ├─[2:0x5564e99d4c98] <string: "x">
#> ├─[2:0x5564e99d4c98]
#> └─[3:0x5564e9ae5160] <string: "y">