like: Convenience function for calling regexpr.

Description Usage Arguments Value Note See Also Examples

Description

Intended for use in [.data.table i.

Usage

1
2

Arguments

vector

Either a character vector or a factor. A factor is faster.

pattern

Passed on to grepl.

Value

Logical vector, TRUE for items that match pattern.

Note

Current implementation does not make use of sorted keys.

See Also

data.table, grepl

Examples

1
2
    DT = data.table(Name=c("Mary","George","Martha"), Salary=c(2,3,4))
    DT[Name %like% "^Mar"]

Example output

     Name Salary
1:   Mary      2
2: Martha      4

data.table documentation built on May 2, 2019, 4:57 p.m.