r - How to flatten exactly two dimensions of the nested list? -
suppose have list a built follows:
a1<-list(1,2,list("x",10)) a2<-list("a",list("b"),"c") a3<-list(list("d",list("e")),3.14) a<-list(a1,a2,a3) how can transform a this:
list(1,2,list("x",10),"a",list("b"),"c",list("d",list("e")),3.14) i want solution works arbitrary number of a1, a2, a3... an, not a1, a2 , a3 in example above.
in mathematica use flatten[a,1], how 1 in r?
use unlist recursive=false:
dput(unlist(a,recursive=false)) list(1, 2, list("x", 10), "a", list("b"), "c", list("d", list( "e")), 3.14)
Comments
Post a Comment