Dear R-users,
I need to dynamically recognize the index of a given string myStr in a
vector of string. The problem is that myStr might contain parenthesis,
causing grep not to recognize it the way I want (see below). The help
mentions that the pattern used by grep should be in the POSIX format...
I guess the problem is here; unfortunately, I am not familiar with the
subtleties of the POSIX format
ex:
myStr <- "YD(001)"
headers <-c("TD", "YD(001)", "YD(002)", "T", "Y(001)", "Y(002)")
grep(myStr, headers)
How should I modify my grep call to get the match right?
Thank you for your help,
Sebastien
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.