Skip to content

Instantly share code, notes, and snippets.

@jokergoo
Created February 4, 2021 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jokergoo/7e6100e838281e3586beb2b6ea0c74b3 to your computer and use it in GitHub Desktop.
Save jokergoo/7e6100e838281e3586beb2b6ea0c74b3 to your computer and use it in GitHub Desktop.
gsub_eval = function(pattern, replacement, x, ignore.case = FALSE, perl = FALSE,
fixed = FALSE, useBytes = FALSE, envir = parent.frame()) {
txt = gsub(
pattern = pattern,
replacement = replacement,
x = x,
ignore.case = ignore.case,
perl = perl,
fixed = fixed,
useBytes = useBytes
)
unname(sapply(txt, function(x) glue::glue(x, envir = envir)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment