I know there are plenty of related posts, but I found none of them that solved my issue. The situation is the following: I am using the shinyTree package and when I select a node, its structure is the following
List of 1
$ :List of 1
..$ ParentA:List of 1
.. ..$ ParentB:List of 1
.. .. ..$ ParentC: num 0
this can be reproduced:
mynode = list(list(ParentA=list(ParentB=list(ParentC=0)))
I would like to obtain from this a vector of the names of the nested list
c("ParentA", "ParentB", "ParentC")
I have tried to use recursive functions like
recursive <- function(x){
if(is.list(x)) recursive(x[[1]])
names(x[[1]])
}
with lapply but it did not work... I have no more ideas what to try... Could anyone help please ??
Thanks in advance