#' Grep an Exact Pattern
#'
#' Search for an exact pattern, with no character before or after the pattern.
#' @param pattern The search term.
#' @param x The object to search against.
#' @param ... Other standard arguments - see '?grep' for more details.
#' @keywords grep search exact
#' @export
#' @examples
#' grepE(pattern = 'test', x = c('notest', 'testtwo', 'test', 'est'))
#' [1] 3
grepE <- function(pattern, x, ignore.case = FALSE, perl = FALSE, value = FALSE, fixed = FALSE, useBytes = FALSE, invert = FALSE) {
grep(pattern = paste0('^', pattern, '$'),
x = x,
ignore.case = ignore.case,
perl = perl,
value = value,
fixed = fixed,
useBytes = useBytes,
invert = invert)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.