powered by
The Dict class creates an ordinary (unordered) dictionary. The key-value pairs are stored in an R environment.
Dict
An object of class R6ClassGenerator of length 24.
R6ClassGenerator
Dict$new() Dict$set(key, value) Dict$get(key, default = NULL) Dict$remove(key) Dict$pop(key, default = NULL) Dict$has(key) Dict$keys() Dict$values() Dict$update(d) Dict$size() Dict$as_list()
key: any R object, key of the item
key
value: any R object, value of the item
value
default: the default value of an item if the key is not found
default
OrderedDict and OrderedDictL
# NOT RUN { d <- Dict$new() d$set("apple", 5) d$set("orange", 10) d$set("banana", 3) d$get("apple") d$as_list() # unordered d$pop("orange") d$as_list() # "orange" is removed # }
Run the code above in your browser using DataLab