The casefold() is a built-in R function that is a generalized solution to convert to either lowercase or uppercase letters. It converts a character vector to upper or lower case, depending on the value of the parameter upper.
If you pass upper = FALSE, it will convert to lowercase letters; if you pass upper = TRUE, it will return the uppercase string.
- string: It is a string character or a character data frame.
- upper: It is a case that the string will be lower if mentioned FALSE and upper if mentioned TRUE.
data <- "RICK AND MORTY ARE VINDICATORS" converted <- casefold(data, upper = FALSE) converted
 "rick and morty are vindicators"
You can see from the output that we got the lowercase characters string.
If we pass the upper = TRUE, it will return the uppercase characters string.
Krunal Lathiya is a Software Engineer with over eight years of experience. He has developed a strong foundation in computer science principles and a passion for problem-solving. In addition, Krunal has excellent knowledge of Data Science and Machine Learning, and he is an expert in R Language.