How can I remove empty elements from a list that contain zero length pairlist as character(0), integer(0) etc...
character(0)
integer(0)
list2 # $`hsa:7476
Another option(I think more efficient) by keeping index where element length > 0 :
l[lapply(l,length)>0] ## you can use sapply,rapply [[1]] [1] 1 2 3 [[2]] [1] "foo"