# >
Matching patterns
For these exercises, we’ll use the dog breed traits data set.
- Load tidyverse, import
dog_breed_traits_clean.csv
totraits
, and extract the breed column into an object calledbreeds
that randomly shuffles the breeds using 12 as a seed for randomization.
- View the breeds ending with the letter “s”.
# >
- Create a logical vector showing whether breeds have at least two words in their names.
# >
- Extract the hounds (but don’t release them). That is, return a vector of all breeds that include the string “hound” or “Hound”.
# >
- Extract the breeds that include the following pattern “<wildcard>ep”.
# >
- OK, maybe English Buttdragger isn’t the proper AKC name for this breed. Replace English Buttdragger with English Chaser.
# >
- Replace all instances of “English” with “British” and then return the breeds that include “English” or “British” in them (to check our work).
# >
- Extract the Spaniels and then separate the breed names into different strings for each word and create a matrix out of it.
# >