Dear all, I have a list of arrays : foo<-list(A = c(1,3), B =c(1, 2), C = c(3, 1)) > foo $A [1] 1 3 $B [1] 1 2 $C [1] 3 1 > if( foo$C[1] == 1 ) foo$C[1] > lapply(foo, function(x) if(x[1] == 1 ) x ) $A [1] 1 3 $B [1] 1 2 $C NULL I don't want to list $C NULL in the output. How I can do that ?