# regex is a little faster
icd9 <- rep(times = 500, c("1", "not", "V10.0", " E950", ""))
microbenchmark(times = 1000,
grepl(pattern = "E", icd9, fixed = TRUE) |
grepl(pattern = "e", icd9, fixed = TRUE) |
grepl(pattern = "V", icd9, fixed = TRUE) |
grepl(pattern = "v", icd9, fixed = TRUE))
microbenchmark(times = 1000, grepl(pattern = "[EeVv]", rnd))
Run the code above in your browser using DataLab