In the woRld of R blogging it can sometimes be fun to wRite with all the Rs capitalized. This is entertaining for both the author and the reader but not very efficient. It’s tough to remember to capitalize letters in the middle of the word and even if the writer does remember, it’s extra work to press the shift key. Instead, let’s automate the capitalization of Rs. Luckily, this is pretty easy in R:
# First, make an example blog post data <- "Many times I want to write in r style but I never have the time to even though it makes the other users think I am rad." # Now use gsub to convert r to R data <- gsub("r", "R", data) # Show the new and improved post print(data) [1] "Many times I want to wRite in R style but I neveR have the time to even though it makes the otheR useRs think I am Rad."