R Bootcamp Problem Set 6
Problem Set
Use the data files in the data/ directory to answer the questions.
For this problem set, you are allowed to help each other, but you are not allowed to post correct answers in slack.
Grading rubric
- Everything is good: full points
- Partially correct answer: depends on how many steps are correct
- Reasonable attempt: half points
Libraries
Load the libraries you need for analysis below.
Question 1 - 5 points
Run the following chunk:
Now use logical indexing to find the number of values > 450 in x.
Question 2 - 5 points
Count the number of species in the penguins tibble using forcats::fct_count()
Count number of island + sex combinations using dplyr::count(), and sort the result by count.
Question 3 - 5 points
Use stringr::str_c() to combine upper and lowercase letters from letters and LETTERS with a slash.
Your answer should look like: "A/a" "B/b" "C/c" etc.
Use stringr::str_split() or one of its variants to split up the strings you made above and extract the letter after the slash.
Question 4 - 5 points
Create a ggplot using the diamonds data set.
- Generate a
ggridges::geom_density_ridges()for the prices, with a differentfillcolor for eachcut. - Recolor the densities using
ggplot2::scale_fill_brewer(), choosing a specific palette. - make the outline of the densities black, and change their alpha to 0.2.
- change the theme to
cowplot::theme_minimal_grid() - remove the legend (google: “remove legend from ggplot2”)
- add an informative title and subtitle using
ggplot2::labs().
