# NOT RUN {
### create a new instance
# to create a new instance of the class
dict <- RDict$new()
# of course you can start to add elements when creating the instance
dict <- RDict$new(id0001=1, id0002=2, collapse=list(id0003=3, id0004=4))
# the following sentence is equivalent to the above
dict <- RDict$new(id0001=1, id0002=2, id0003=3, id0004=4)
# where the three lists are inserted into the dictionary
### immutable methods
dict$keys
dict$values
dict$has(id0001)
dict$has("id0005")
# TRUE as it has the key attribute
dict$get(id0006)
dict$get("id0002")
### mutable methods
dict$add(id0005, 5)
dict$add(key="id0006", val=6)
dict$delete(id0001)
# }
Run the code above in your browser using DataLab