I could not find a fix for this error. I used to implement workarounds, but I wonder if anyone knows about this, why this happens.
the following returns an error as expected
q <- list()
q[["a"]][["b"]] <- 3
q[["a"]][["c"]] <- 4
However, when I add another level of nesting, I get:
q <- list()
q[["a"]][["b"]][["c"]]<- 3
q[["a"]][["b"]][["d"]] <- 4
"Error in q [[" a "]] [[" b "]] [[" d "]] <- 4: more items added than replaced"
To make this even more confusing, if I add a fourth nested list, I get:
q <- list()
q[["a"]][["b"]][["c"]][["d"]] <- 3
q[["a"]][["b"]][["c"]][["e"]] <- 4
Error in *tmp*[["c"]]: index outside
I would expect R to return the same error message for a triple nested list as it would for a quadruple nested list
. R 3.4.3 R