I want to make the equivalent of a python dict in R. Basically, in python I have:
visited = {}
if atom_count not in visited:
Do stuff
visited[atom_count] =
The closest thing to a python dict in R is simply a list. Like most R data types, lists can have a names attribute that can allow lists to act like a set of name-value pairs:
> l <- list(a = 1,b = "foo",c = 1:5)
> l
$a
[1] 1
$b
[1] "foo"
$c
[1] 1 2 3 4 5
> l[['c']]
[1] 1 2 3 4 5
> l[['b']]
[1] "foo"
Now for the usual disclaimer: they are not exactly the same; there will be differences. So you will be inviting disappointment to try to literally use lists exactly the way you might use a dict in python.