# >
Separating and uniting data
For these exercises, we’ll use a new clean version of the dog breed traits data set.
- Load tidyverse, import data from https://jeffreyrstevens.quarto.pub/dpavir/data/dog_breed_traits_clean.csv, and assign it to
traits
.
- Create
traits2
which adds a coat column that combines coat_type and coat_length into single column delimited by “-”.
# >
- Split the coat column into type and length and keep the original coat column.
# >
- Create
traits3
fromtraits
that (1) removes the coat columns, (2) turns the ratings columns into long format, and (3) removes the children row for Bulldogs.
# >
- Create
traits4
fromtraits3
that ensures a complete data set with all five ratings for all breeds (and fills in missing combinations withNA
) and check for the missing Bulldog children row.
# >
- How could we copy the rating from the previous row into the Bulldog children row to replace the
NA
? (Note this is not a good idea in this case!)
# >
- From
traits
, generate all combinations of coat type and length observed in the data, excludingNA
.
# >
- From
traits
, generate all possible combinations of coat type and length, excludingNA
.
# >