1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Statistics in R

Exercise

Variance and standard deviation

Variance and standard deviation are two of the most common ways to measure the spread of a variable, and you'll practice calculating these in this exercise. Spread is important since it can help inform expectations. For example, if a salesperson sells a mean of 20 products a day, but has a standard deviation of 10 products, there will probably be days where they sell 40 products, but also days where they only sell one or two. Information like this is important, especially when making predictions.

Both dplyr and ggplot2 are loaded, and food_consumption is available.

Instructions

100 XP
  • Calculate the variance and standard deviation of co2_emission for each food_category by grouping by and summarizing variance as var_co2 and standard deviation as sd_co2.
  • Create a histogram of co2_emission for each food_category using facet_wrap().