For example
testList<-list(list(a=1,b=2,c=3),c(1,2),list(a=1,b=2,c=0))
I have a list of either numeric vectors or lists of 3 elements.
I want a boolean indicating list elements where the third element (element c) >0.
If I run
sapply(testList,function(x)is.list(x) & x[[3]]>1)
I get Error in x[[3]] : subscript out of bounds. But really the problem is that the x[[3]]>1 should only be applied to the lists, not the vectors.
The boolean needs to be of length testList. Any simple way of doing this?
