Separating and uniting data

Author

Jeffrey R. Stevens

Published

February 27, 2023

For these exercises, we’ll use a new clean version of the dog breed traits data set.

  1. Load tidyverse, import data from https://jeffreyrstevens.quarto.pub/dpavir/data/dog_breed_traits_clean.csv, and assign it to traits.
# >
  1. Create traits2 which adds a coat column that combines coat_type and coat_length into single column delimited by “-”.
# >
  1. Split the coat column into type and length and keep the original coat column.
# >
  1. Create traits3 from traits that (1) removes the coat columns, (2) turns the ratings columns into long format, and (3) removes the children row for Bulldogs.
# >
  1. Create traits4 from traits3 that ensures a complete data set with all five ratings for all breeds (and fills in missing combinations with NA) and check for the missing Bulldog children row.
# >
  1. 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!)
# >
  1. From traits, generate all combinations of coat type and length observed in the data, excluding NA.
# >
  1. From traits, generate all possible combinations of coat type and length, excluding NA.
# >