Is there an easy way (i.e. a function) to determine the level of nesting in list? I know there is str which can be used to get this information. But is there so
str
If all elements are named, you could use this (from the code of unlist):
unlist
mylist <- list(a=list(x=1),b=list(c=list(y=c(2,3)),d=c("a","b"))) names(.Internal(unlist(mylist, TRUE, TRUE))) #[1] "a.x" "b.c.y1" "b.c.y2" "b.d1" "b.d2"