Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 204715

Find vector of strings in list (R)

$
0
0

I have a list, in which each element is a vector of strings, as:

l <- list(c("a", "b"), c("c", "d"))

I want to find the index of the element in l that contains a specific vector of strings, as c("a", "b"). How do I do that? I thought which(l %in% c("a", "b")) should work, but it returns integer(0) instead of 1.


Viewing all articles
Browse latest Browse all 204715

Trending Articles