0

Is there a way to reuse the regex pattern when searching text to replace using dplyr::str_replace() (or replace_all())?

E.g.: change 'apple' to 'apples': this would require adding 's' to the search pattern 'apple', like str_replace_all(string = data, pattern = "apple", replacement = pattern"s"), with obviously something else as 'pattern'

fbl
  • 13
  • 5

0 Answers0