dictionar6 is an R6 dictionary interface that makes use of symbolic representation to efficiently store R6 and non-R6 objects as symbols to prevent issues with cloning, large object sizes, or construction bottlenecks. The dictionary contains all ‘usual’ methods for getting and setting elements.
Some main features/key use-cases of dictionar6 includes:
dct(a = 1, b = "2")
dct(a = 1L, b = 2L, c = 3L, types = "integer")
d <- dct(a = 1, b = 2) d$has("a")
d <- dct(a = 1, b = 2) d$rekey("a", "c") d$keys
d$revalue("b", 3) d$items
r <- RClass$new(1) r$values()
d <- dct(a = r) # default is to clone d$get("a", clone = TRUE)$add(2) # r is unaffected r$values()
# if we don't clone... d$get("a", clone = FALSE)$add(2) # r is affected r$values()
For the latest release on CRAN, install with
Otherwise for the latest stable build
dictionar6 is currently used in param6 to provide a symbolic representation for R6 classes. This is incredibly useful to prevent storing unnecessarily large R6 objects. param6 comes pre-loaded with a Dictionary of mathematical sets where the keys are symbolic representations of the sets and the values are the sets themselves, this allows users to refer to R6 objects with their character representation without having to continually construct new objects.
The dictionar6 API is still experimental and may be subject to major changes. Currently it’s primary use-case is in param6, minor or major changes will be made to satisfy this dependency. Future development will then focus on code quality and speed.