toupper() function in detail
The toupper() function in R is used to convert a lowercase string to an uppercase string.
Syntax:
Return: Returns the uppercase version of the given string.
Example 1:
# R program to convert a string
# from lowercase to uppercase
# Given String
text <- "Welcome to the world of R programming"
# Using toupper() method
result <- toupper(text)
print(result)
Output:
[1] "WELCOME TO THE WORLD OF R PROGRAMMING"
Example 2:
# R program to convert a string
# from lowercase to uppercase
# Given String
sentence <- "Practice makes a person perfect"
# Using toupper() method
converted <- toupper(sentence)
print(converted)
Output:
[1] "PRACTICE MAKES A PERSON PERFECT"
Leave a Reply