The “tolower” Function in R

  • Package: Base R (No specific package, it’s a built-in function)

  • Purpose: To convert characters in a character vector to lowercase.

  • General Class: String Manipulation

  • Required Argument(s):

    • x: A character vector to be converted to lowercase.

  • Notable Optional Arguments:

    • None

  • Example:

  • # Example usage
    words <- c("Apple", "Banana", "Orange", "Grape")

    # Convert all characters in the vector to lowercase
    lowercase_words <- tolower(words)

    print(lowercase_words)

  • In this example, tolower is a built-in function in base R, and it is used to convert all characters in a character vector (words) to lowercase. The x argument is required, and there are no additional optional arguments. The result is a character vector with all elements converted to lowercase.

Previous
Previous

The “toupper” Function in R

Next
Next

The “regmatches” Function in R