# >Merging rows
For these exercises, we’ll use the dog breed traits and dog breed popularity rankings data sets.
- Load tidyverse, import
dog_breed_traits_clean.csvtotraits, importdog_breed_ranks.csvtoranks, and importdog_breed_popularity.csvtopopularity.
- First, set a random seed by using
set.seed(2). Then create a subset ofranksthat is a random selection of 10% of the rows, sort by breed name, and assign toranks2.
# >- Use a filtering join to return the subset of
traitsthat matches the breeds inranks2and assign this totraits2.
# >- Use a filtering join to return the subset of
traitsthat excludes the breeds inranks2.
# >- Now we want to filter
traitsbased on breeds inpopularity. Notice that the breeds column inpopularityis called Breed. This is problematic because the breed column intraitsis called breed and names are case-sensitive. Usejoin_by()to filtertraitsby breeds inpopularity. How many rows are there?
# >- Use
filter()(not joins) to return the subset oftraitsthat excludes the breeds inranks2.
# >- Append
traits2to the bottom of itself.
# >- Append
traits2to the right of itself.
# >- Append
traits2to the right ofranks2.
# >- Why is this not a good idea? What would be a better way to achieve this?
# >