powered by
which(grepl(pattern, x)) is the same as grep(pattern, x), but harder to read and requires two passes over the vector.
which(grepl(pattern, x))
grep(pattern, x)
which_grepl_linter()
consistency, efficiency, readability, regex
linters for a complete list of linters available in lintr.
# will produce lints lint( text = "which(grepl('^a', x))", linters = which_grepl_linter() ) # okay lint( text = "which(grepl('^a', x) | grepl('^b', x))", linters = which_grepl_linter() )
Run the code above in your browser using DataLab