Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Strings basics
Regular expressions
Modifying strings
21. Exercise 1


Let's summarize what we learned and take a short quiz, shall we? In this part, we learned how to manipulate strings by:

  • Joining them with the paste() function:
    paste("Leopold", "Bloom")
  • Creating a substring with the substr() function:
    substr(cities, start = 1, stop = 2)
  • Changing letter cases with the tolower() and toupper() functions:
    toupper("LeT's CoDe!")
    tolower("LeT's CoDe!")
  • Replacing characters in the string with the sub() and gsub() functions:
    names <- sub("_", " ", names)
    names <- gsub("[[:digit:]]", "", names)

Let's review all this information. We'll start by looking at a new data set, reservations, that is all about hotel guests.


Check the reservations data set using the str() function.