Practice Questions
Now practice combining all of the functions you have learned to answer the following questions.
Some of the questions will have multiple answers or it is possible for you to have a different order to your pipes and still get the correct result.
- Write code that will result in printing out just the flipper lengths of Chinstrap penguins.
Answer
- Find out how many male penguins there are versus how many female. (Hint: look at the length of the tibble to find number of rows.)
Answer
- Make a new dataset called biscoe that is only the species and flipper length for the Biscoe island penguins in 2008 and 2009.
Answer
- Are there any missing values for flipper length in the biscoe dataset?
Answer
- Create a dataset called bills of just the bill measurements (not flipper or mass), including a measurement for bill ratio.
Answer
- The average bill ratio is 2.6. Using bills, create a column that called diff that finds the difference between each penguins bill and the average. Ensure that the diff column doesn’t have any missing values and that it saves to the bills dataset.
Answer
- Using the diff column, find out which species has the most penguins with an above average bill ratio.
Answer
- Show a table that includes all Gentoo penguins and any other penguins over 4500g. Add a column called size to indicate these penguins as “large”.
Answer