# >
Pivoting data
For these exercises, we’ll use a new clean version of the dog breed traits data set.
- Import data from https://jeffreyrstevens.quarto.pub/dpavir/data/dog_breed_traits_clean.csv and assign to
traits
.
- Create
traits2
where we delete the coat columns, so we only have breed and ratings data.
# >
Is
traits2
tidy?Is
traits2
in wide or long format?Reshape
traits2
so that all of the ratings scores are in a single column called rating with a column labeling what kind of rating it is called scale. Assign this totraits3
.
# >
How would we check if
traits3
has the expected number of rows?Create
traits4
by removing the rows with affectionate, children, and other_dogs as values of scale.
# >
- Spread out the data into wide format with separate columns for the shedding and grooming data, then create a new column diff that subtracts grooming from shedding ratings.
# >