This is a canonical method for determining whether all items in a list are the same:
length(unique(object))==1
In your case:
> length( unique( eventual.list ) ) [1] 2 > length( unique( eventual.list ) ) == 1 [1] FALSE
The help page for unique could make you think that the lists will not be processed until it reflects on this result, which surprised me when I came across it for the first time:
is.vector( eventual.list ) [1] TRUE
Thus, lists are technically vectors in R parlance, they simply are not “atomic” vectors, they are “recursive”.
> is.atomic(eventual.list) [1] FALSE > is.recursive(eventual.list) [1] TRUE
source share