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
.