Using the (preferably) rlist package, is there a way to filter out the nodes of a (multi-level) list so that the resulting list does not have NA values ββat any level?
library(rlist) devs <- list( p1=list(name="Ken",age=24, interest=c("reading","music","movies"), lang=list(r=NA,csharp=4)), # <------ NA here p2=list(name="James",age=25, interest=c("sports","music"), lang=list(r=3,java=2,cpp=5)), p3=list(name="Penny",age=NA, # <------ NA here interest=c("movies","reading"), lang=list(r=1,cpp=4,python=2)))
In the above example, since the nodes p1 and p3 contain NA somewhere in their hierarchy, the expected list of results should be p2 . We do not know in advance the structure or names of the input list.
source share