How do you detect if a string starts with a specific substring in R?

How do you detect if a string starts with a specific substring in R?

a) str_starts()
b) startsWith()
c) start_string()
d) begins()

Answer:

b) startsWith()

Explanation:

The startsWith() function checks if a string starts with a given substring in R.

Reference:

R Programming – String MCQ Questions and Answers

Scroll to Top