Say I have the following list (note the usage of non-syntactic names)
list <- list(A = c(1,2,3),
`2` = c(7,8,9))
So the following two way of parsing the list works:
`$`(list,A)
## [1] 1 2 3
`$`(list,`2`)
## [1] 7 8 9
However, this way to proceed fails.
id <- 2
`$`(list,id)
## NULL
Could someone explain why the last way does not work and how I could fix it? Thank you.