Intended for use in
[.data.table, i.e., for subsetting/filtering.
Syntax should be familiar to SQL users, with interpretation as regex.
like(vector, pattern, ignore.case = FALSE, fixed = FALSE) vector %like% pattern vector %ilike% pattern vector %flike% pattern
Pattern to be matched
like is essentially a wrapper around
base::grepl, except that it is smarter about handling
factor input (
base::grep uses slow
TRUE for items that match
Current implementation does not make use of sorted keys.
DT = data.table(Name=c("Mary","George","Martha"), Salary=c(2,3,4)) DT[Name %like% "^Mar"] DT[Name %ilike% "mar"] DT[Name %flike% "Mar"]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.