Okay, time to move to some more complex string operations. Let's start with the
substr() function, which allows us to select part of each string (i.e., a substring) in a vector. The arguments are the vector of strings, where we
start the selection in each string, and where we
We have in memory two vectors containing the names of cities and countries where our clients live. If we wanted to get only the first two letters of each city name, we can use the
substr() function in the following way:
substr(cities, start = 1, stop = 2)
stop parameters are indexes of the first and last characters of the substring we want to get.