In R I was wondering if I could have a dictionary (in a sense like python) where I have a pair (i, j) as the key with a corresponding integer value. I have not
You can just use a data.frame:
a = data.frame(spam = c("alpha", "gamma", "beta"),
shrub = c("primus","inter","parus"),
stringsAsFactors = FALSE)
rownames(a) = c("John", "Eli","Seth")
> a
spam shrub
John alpha primus
Eli gamma inter
Seth beta parus
> a["John", "spam"]
[1] "alpha"
This handles the case with a 2d dictionary style object with named keys. The keys can also be integers, although they might have to be characters in stead of numeric's.