I have stored pattern matching functions as strings
eg. string <- "grepl('a',var1)"
for selecting rows of a data.table
In some cases i have to use metacharacters
dt<-data.table(var=c("a1b.c","a-b.c","a1b1c"))
dt[grepl("a.b\\.c",var),]
I don't understand what "\" especially "\." leads to in the parse
function
finally
dt[eval(parse(text="grepl('a.b\\.c',var)")),] # won't work
even so
dt[eval(parse(text="grepl('a.b[.]c',var)")),] # will work
I want to understand what parse
does exactly in case the metacharcter I have to use is e.g "^".