The “str_to_upper” Function in R
Package: stringr
Purpose: To convert the characters in a character vector to uppercase.
General Class: String Manipulation
Required Argument(s):
string: A character vector to be converted to uppercase.
Notable Optional Arguments:
None
Example:
# Example usage
library(stringr)
words <- c("apple", "banana", "orange", "grape")
# Convert all words to uppercase
uppercased_words <- str_to_upper(words)
print(uppercased_words)In this example, the str_to_upper function from the stringr package is used to convert all words in the character vector words to uppercase. The result is a character vector with the uppercase versions of the original words.