The function used to replace a pattern in a string in R is ________.

  • gsub()
  • replace()
  • replacestr()
  • str_replace()
The gsub() function in R is used to replace a pattern in a string. For example, gsub("a", "b", "banana") would replace all occurrences of "a" with "b" in the string "banana".
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *