ExecKeywords <- c('cio','cto','cco','coo','ciso','cso','cdo','cdio',
'Chief Information','CIO','Chief Technology Officer','Chief Compliance Officer','Chief Security')
Titles <- c('Director - Customer Success','CIO','Director Cloud Operations',
'Director of Information Technology and Chief Information Security Officer',
'Director, Information Services','Director, Global Information Technology',
'Chief Technology Officer','Sr. Director','COO / CTO Advice Company',
'Director of Information Technology','Director of Technology',
'Vice President, Platform Operations and Information Technology',
'Accounting Manager','VP, Strategy and Programs','IT Director','CTO',
'Director of Network Services','Director','Director, Application Engineering',
'Deputy Director of Technology')
grep(paste(ExecKeywords, collapse = "|"), Titles, value = T)
I am trying to identify titles that match one of the multiple patterns found in ExecKeywords. Placing a space after each element of ExecKeywords, before the pipe and after the pipe (in collapse) all seem to do something different but not what I am looking for. All of the posts reference the paste & collapse method but that does not seem to be working for me...am I missing something? ignore.case does not seem to work as expected either
should be expecting a return like this
'CIO','Director of Information Technology and Chief Information Security Officer','Chief Technology Officer','COO / CTO Advice Company','CTO'
One option is to have a word boundary paste
d as well to avoid matching substrings in words
grep(paste0("\\b(", paste(ExecKeywords, collapse = "|"), ")\\b"),
Titles, value = TRUE, ignore.case = TRUE)
#[1] "CIO"
#[2] "Director of Information Technology and Chief Information Security Officer"
#[3] "Chief Technology Officer"
#[4] "COO / CTO Advice Company"
#[5] "CTO"