I want to store an object with a number vector as key in some data structure, such that I can later retrieve that object when I supply the data structure with an identical vector. How can I do that?
All vectors have the same number of elements. The number of objects that will be stored is low (<20).
Something like:
hash[c(1,2,4)] <- myObject
You could use a
listand turn your vector key into a unique character key, usingpastefor example:Same idea for retrieving the object: