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)
print(x1)
print(x2)

cat("\n")

v1 <- c("Python", "C++", "Java", "SQL", "R")
v2 <- tolower(v1)
print(v1)
print(v2)

The output of the above code will be:

[1] "Hello World! 123"
[1] "hello world! 123"

[1] "Python" "C++"    "Java"   "SQL"    "R"     
[1] "python" "c++"    "java"   "sql"    "r"   

❮ R String Functions