How do you trim leading and trailing whitespaces in R?

How do you trim leading and trailing whitespaces in R?

a) strip()
b) trim()
c) trimws()
d) stripws()

Answer:

c) trimws()

Explanation:

The trimws() function removes leading and trailing whitespaces from 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