How to access any value of list which is nested under another list in R

r

#1

I want to access the value which is nested under other list
x<-list(a=list(10,11,12),b=c(2,3))

I want to access the element 12


#2

Hello @sid100158,

Please use as below:


#3

Another thing to note here is that if you use

x$a[3]
[[1]]
[1] 12
i.e. the output will be a list while if you do the same for b as follows:
x$b[1]
[1] 2
the output will be a vector.