Convert String from Uppercase to Lowercase in R programming – tolower() method

tolower() Method in detail

The tolower() function in R is used to convert uppercase letters in a string to lowercase.

Syntax:

tolower(s)

Return: Returns the string in lowercase.

Example 1:

# R program to convert string
# from uppercase to lowercase

text <- "Hello World"

# Using tolower() method
result <- tolower(text)

print(result)

Output:

[1] "hello world"

Example 2: 

# R program to convert string
# from uppercase to lowercase

# Given String
sentence <- "ProGRamMing in R is FuN!"

# Using tolower() method
result <- tolower(sentence)

print(result)

Output:

[1] "programming in r is fun!"

Comments

Leave a Reply

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