The “toupper” Function in R

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

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

  • General Class: String Manipulation

  • Required Argument(s):

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

  • Notable Optional Arguments:

    • None

  • Example:

  • # Example usage
    words <- c("apple", "banana", "orange", "grape")

    # Convert all characters in the vector to uppercase
    uppercase_words <- toupper(words)

    print(uppercase_words)

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

Previous
Previous

The “substring” Function in R

Next
Next

The “tolower” Function in R