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:0x56ba5fef7570] <int>
y <- list(x, x, x)
ref(y)
#> █ [1:0x56ba5f86db18] <list>
#> ├─[2:0x56ba5fef7570] <int>
#> ├─[2:0x56ba5fef7570]
#> └─[2:0x56ba5fef7570]
ref(x, y)
#> [1:0x56ba5fef7570] <int>
#>
#> █ [2:0x56ba5f86db18] <list>
#> ├─[1:0x56ba5fef7570]
#> ├─[1:0x56ba5fef7570]
#> └─[1:0x56ba5fef7570]
e <- new.env()
e$e <- e
e$x <- x
e$y <- list(x, e)
ref(e)
#> █ [1:0x56ba6026be90] <env>
#> ├─x = [2:0x56ba5fef7570] <int>
#> ├─y = █ [3:0x56ba5d058578] <list>
#> │ ├─[2:0x56ba5fef7570]
#> │ └─[1:0x56ba6026be90]
#> └─e = [1:0x56ba6026be90]
# Can also show references to global string pool if requested
ref(c("x", "x", "y"))
#> [1:0x56ba60585568] <chr>
ref(c("x", "x", "y"), character = TRUE)
#> █ [1:0x56ba61224e08] <chr>
#> ├─[2:0x56ba59ba2fe0] <string: "x">
#> ├─[2:0x56ba59ba2fe0]
#> └─[3:0x56ba59cb2b28] <string: "y">