I am trying to store a list within a list in a way that I can access it by list ID just like Python dictionary:
idList <- list('A','B','C','D','E')
subnet <- list('A'=0,'B'=0,'C'=0,'D'=0,'E'=0)
for (ids in idList) {
tmp <- c('some','random','list')
subnet$ids <- tmp
}
But when I check the results as subnet$A
I get the value 0
I am not able to understand why the tmp
value is not being stored in the subnet
list?
When I do it on the command line individually, then it works:
R> subnet$A <- tmp
R> subnet$A
R> "some" "random" "list"
To me R is weird and it works in a completely unintuitive way.