I have a list with 6 elements:
{
"a": {
"b": {
"strA": {
"strB": {
"c": {
"$": 8888
}
}
}
}
}
}
print(unlist(a$b$strA$strB)) works if I type it in the values for strA and strB manually.
However, what I would like to do is itterate through the list in a loop with various values for strA and strB
for (i in 1:nrow(h)) {
x=strsplit(x=h[i, 1], "\\.") # this bit works for me
y <- unlist(a) # this bit works for me and gives me y[1] and y[2]
if (x==a$b$y[1]$y[2]){ # this bit does not work yet
<etc.>
}
}
The problem is that I cannot get the if clause to work on variables. How do I get this to work? Any help is greatly appreciated.