like.Rd
Intended for use in i
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
vector | Either a |
---|---|
pattern | Pattern to be matched |
ignore.case |
|
fixed |
|
Internally, like
is essentially a wrapper around grepl
, except that it is smarter about handling factor
input (base::grep
uses slow as.character
conversion).
Logical vector, TRUE
for items that match pattern
.
Current implementation does not make use of sorted keys.
#> Name Salary #> 1: Mary 2 #> 2: Martha 4DT[Name %ilike% "mar"]#> Name Salary #> 1: Mary 2 #> 2: Martha 4DT[Name %flike% "Mar"]#> Name Salary #> 1: Mary 2 #> 2: Martha 4