R Tutorial R Charts & Graphs R Statistics R References

R - tolower() Function



The R tolower() function is used to convert all characters of the string in lowercase. Any symbol, space, or number in the string is ignored while applying this function. Only alphabet are converted. The syntax for using this function is given below:

Syntax

tolower(x)

Parameters

x Required. Specify text to be converted.

Return Value

Returns the string with all characters of the specified string in lowercase.

Example:

The example below shows the usage of tolower() function.

x1 <- "Hello World! 123"
x2 <- tolower(x1)
cat("x1:", x1, "\n")
cat("x2:", x2, "\n")

cat("\n")

v1 <- c("Python", "C++", "Java", "SQL", "R")
v2 <- tolower(v1)
cat("v1:", v1, "\n")
cat("v2:", v2, "\n")

The output of the above code will be:

x1: Hello World! 123 
x2: hello world! 123 

v1: Python C++ Java SQL R 
v2: python c++ java sql r 

❮ R String Functions

5