I have to modify %in% operator which will find an objects in a list.
I have a list:
list1 <- list(c(5,6), 6, list(2, c(5, 6)), "string")
Non-modified %in% operator after testing these values:
c(5,6) %in% list1
6 %in% list1
2 %in% list1
list(2, c(5,6)) %in% list1
will return:
TRUE
TRUE
FALSE
FALSE
but for list(2, c(5,6)) %in% list1 I need it to return TRUE as it is an element of this list.
I have to implement it without using loops and I got stuck.