I need to write a query in R to match partial string in column names. I am looking for something similar to LIKE operator in SQL. For e.g, if I know beginning, middle or end
In regular expressions, ^ specifies the beginning of the string, $ specifies the end, thus:
^
$
y<- c("I am looking for a dog", "looking for a new dog", "a dog", "I am just looking") grep("^looking.*dog$", y) [1] 2