str_replace() will match a pattern within a string and replace it with a new string specified by the user. Note: str_replace will only replace the first matched pattern in the string. To match all patterns in a string, use str_replace_all().
Arguments:
string: the string or character object you want to run the function on.
pattern: the pattern to search the string for. (should be contained in quotation marks: "pattern").
replacement: the string you would like to replace the matched pattern with. (should be contained in quotation marks: "replacement").
str_replace() will match a pattern all specified patterns within a string and replace it with a new string specified by the user.
Arguments:
string: the string or character object you want to run the function on.
pattern: the pattern to search the string for. (should be contained in quotation marks: "pattern").
replacement: the string you would like to replace the matched pattern with. (should be contained in quotation marks: "replacement").
The stringr package contains a number of functions that allow users to change the case type of character objects. Below you will find a list of these functions.
str_to_lower(string): Transform all characters in a string to lower-case letters.
str_to_upper(string): Transform all characters in a string to upper-case letters.
str_to_title(string): Capitalize the first character in a string following a punctuation mark.