Convert First letter of every word to Uppercase in R Programming – str_to_title() Function
Last Updated :
03 Jun, 2020
str_to_title()
Function in R Language is used to convert the first letter of every word of a string to Uppercase and the rest of the letters are converted to lower case.
Note: This function uses 'stringr' library.
Syntax: str_to_title(string)
Parameter:
string: string to be converted
Example 1:
library(stringr)
str < - "geeks for geeks"
str_to_title( str )
|
Output:
[1] "Geeks For Geeks"
Example 2:
library(stringr)
str < - "GEEKS FOR GEEKS"
str_to_title( str )
|
Output:
[1] "Geeks For Geeks"
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...