Learn R Programming

data.table (version 1.12.2)

like: Convenience function for calling regexpr.

Description

Intended for use in i in [.data.table.

Usage

like(vector,pattern)
vector %like% pattern

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.

See Also

data.table, grepl

Examples

Run this code
# NOT RUN {
DT = data.table(Name=c("Mary","George","Martha"), Salary=c(2,3,4))
DT[Name %like% "^Mar"]
# }

Run the code above in your browser using DataLab