grepl() function allows you to search strings using more sophisticated criteria. For example, with
grepl() we can get all cities with names that start with the letter "A". To do that, we have to define the pattern we're looking for in such a way that R will understand it. So we use something called regular expressions. In this case, we're looking for all city names that start with "A", so we write:
"^A" tells R "look in the following vector for everything that starts with the letter A". In this way, we're telling R to match a certain pattern.