The “str_to_lower” Function in R

  • Package: stringr

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

  • General Class: String Manipulation

  • Required Argument(s):

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

  • Notable Optional Arguments:

    • None

  • Example:

  • # Example usage
    library(stringr)

    words <- c("Apple", "Banana", "Orange", "Grape")

    # Convert all words to lowercase
    lowercased_words <- str_to_lower(words)

    print(lowercased_words)

  • In this example, the str_to_lower function from the stringr package is used to convert all words in the character vector words to lowercase. The result is a character vector with the lowercase versions of the original words.

Previous
Previous

The “str_to_upper” Function in R

Next
Next

The “str_sub” Function in R