How do you replace a part of a string in R?

How do you replace a part of a string in R?

a) replace()
b) gsub()
c) str_replace()
d) substitute()

Answer:

b) gsub()

Explanation:

The gsub() function is used to replace all occurrences of a pattern in a string in R.

Reference:

R Programming – String MCQ Questions and Answers

Leave a Comment

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

Scroll to Top