Practice Problems 1.2

Here are some practice problems to explore the penguins data set. First we need to load the penguin data set.

library("palmerpenguins")

penguins
# A tibble: 344 × 8
   species island    bill_length_mm bill_depth_mm flipper_length_mm body_mass_g
   <fct>   <fct>              <dbl>         <dbl>             <int>       <int>
 1 Adelie  Torgersen           39.1          18.7               181        3750
 2 Adelie  Torgersen           39.5          17.4               186        3800
 3 Adelie  Torgersen           40.3          18                 195        3250
 4 Adelie  Torgersen           NA            NA                  NA          NA
 5 Adelie  Torgersen           36.7          19.3               193        3450
 6 Adelie  Torgersen           39.3          20.6               190        3650
 7 Adelie  Torgersen           38.9          17.8               181        3625
 8 Adelie  Torgersen           39.2          19.6               195        4675
 9 Adelie  Torgersen           34.1          18.1               193        3475
10 Adelie  Torgersen           42            20.2               190        4250
# ℹ 334 more rows
# ℹ 2 more variables: sex <fct>, year <int>
  1. What are the mean and standard deviation of bill length of the penguins?
# create a variable that contains only the column for bill length



# mean 

# standard deviation
  1. What are the mean and standard deviation of the body mass of the penguins?
# create a variable that contains only the column for body mass

# mean

# standard deviation
  1. What is the mean and median flipper length of the penguins?
# create a variable that contains only the column for flipper length

# mean

# median
  1. How long are the largest flippers in this data set? How long is the shortest? (Hint: google how to find the minimum and maximum values in a vector). You can use the same variable that you created in 3!
# longest flipper length

# shortest flipper length
  1. What is the range of bill depths of penguins? (Range is the maximum value - minimum value)
# deepest bill depth

# shallowest bill depth

# range of bill depth
  1. How many species of penguins are in this data set (hint: there is a function to find distinct values in a vector)? List them using comments.
  1. Find the value for the longest bill in the data set. Assign it to the variable longestBill.
  1. Calculate the variance of body mass. (Hint: google variance in R)
  1. Calculate the variance of flipper length.
  1. Calculate and compare the standard deviation of bill length and bill depth. Which has a larger standard deviation?
# standard deviation of bill length

# standard deviation of bill depth

# Which has a larger standard deviation? 
  1. Challenge: calculate the mean and standard deviation of bill length for gentoo penguins