To check if two strings are equal ignoring case in R, you can use the toupper()
or tolower()
functions to convert both strings to uppercase or lowercase and then compare them.
In this example,
str1
and str2
with different cases, such as "Hello"
and "hello"
.toupper()
or tolower()
functions.==
operator.TRUE
if the strings are equal ignoring case, and FALSE
otherwise.# Equality Check Ignoring Case in R
str1 <- "Hello"
str2 <- "hello"
result <- toupper(str1) == toupper(str2)
print(paste("Strings are equal ignoring case:", result))
[1] "Strings are equal ignoring case: TRUE"
In this tutorial, we learned How to check if Two Strings are Equal ignoring case in R language with well detailed examples.