How do I remove the null elements from a list of lists, like below, in R:
lll <- list(list(NULL),list(1),list(\"a\"))
The object I want
Here's an option using Filter and Negate combination
Filter
Negate
Filter(Negate(function(x) is.null(unlist(x))), lll) # [[1]] # [[1]][[1]] # [1] 1 # # # [[2]] # [[2]][[1]] # [1] "a"