I am using match for getting if an element is in a list. For example my list is:
c(\"a\",\"b\",\"h\",\"e\"...) and so on
if I want to see
The which
function would tell you where in a vector an item would "match". The %in%
will return a logical vector of the same length as its first argument, and if
will only look at the first logical value so will not work well by itself. You could do this:
if( any("h" %in& v) ) { do something }
The any
function allows you to "collapse" the result of %in%