Skip to content
Prev 200330 / 398503 Next

where is a value in my list

The term "line" in R refers to a sequence of text ending in and  
<EOL> marker, which I doubt is what you meant. Please stop referring  
to the items or elements of a list as "lines" if you hope to  
communicate with R-users.

 > lista[1:2]
[[1]]
[1] 2 4 5 5 6

[[2]]
[1] 3 5 4 2

 > lista[ which(sapply(lista, function(x) any(x == 5))) ]
[[1]]
[1] 2 4 5 5 6

[[2]]
[1] 3 5 4 2