Rows: 195 Columns: 17
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (3): Breed, Coat Type, Coat Length
dbl (14): Affectionate With Family, Good With Young Children, Good With Othe...
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
View traits to see what it looks like.
head(traits)
# A tibble: 6 × 17
Breed Affectionate With Fa…¹ Good With Young Chil…² `Good With Other Dogs`
<chr> <dbl> <dbl> <dbl>
1 Retrieve… 5 5 5
2 French B… 5 5 4
3 German S… 5 5 3
4 Retrieve… 5 5 5
5 Bulldogs 4 3 3
6 Poodles 5 5 3
# ℹ abbreviated names: ¹`Affectionate With Family`, ²`Good With Young Children`
# ℹ 13 more variables: `Shedding Level` <dbl>, `Coat Grooming Frequency` <dbl>,
# `Drooling Level` <dbl>, `Coat Type` <chr>, `Coat Length` <chr>,
# `Openness To Strangers` <dbl>, `Playfulness Level` <dbl>,
# `Watchdog/Protective Nature` <dbl>, `Adaptability Level` <dbl>,
# `Trainability Level` <dbl>, `Energy Level` <dbl>, `Barking Level` <dbl>,
# `Mental Stimulation Needs` <dbl>
Reassign traits with only the columns Breed through Coat Length.
traits <-select(traits, Breed:`Coat Length`)
Reassign traits removing the Drooling Level column. That’s gross.
traits <-select(traits, -`Drooling Level`)
What terrible column names! Reassign traits and change the column names to "breed", "affectionate", "children", "other_dogs", "shedding", "grooming", "coat_type", "coat_length". Note, use the colnames() function rather than select() or rename() since you already have the full vector of names.
The ratings are supposed to run from 0 to 4 rather than 1 to 5. Change the affectionate column by subtracting 1 from the original numbers to rescale the values. Don’t reassign traits.
Create a new column called shed that dichotomizes shedding such that values of 3 and above are “A lot” and values below 3 are “Not much”. Do you need to account for missing data?
mutate(traits, shed =ifelse(shedding >2, "A lot", "Not much"))