1. Learn
  2. /
  3. Courses
  4. /
  5. Basic Statistics

Exercise

Range

The range of a variable is the difference between the highest and lowest value. We can find these values using max() and min() on the variables of our choice. The value returned tells us which row (or case) contains the requested value. We can then index this case to find the desired values. Remember, you can index using [].

Instructions

100 XP
  • In your script, assign the minimum value of mtcars$mpg to x
  • In your script, assign the maximum value of mtcars$mpg to y
  • In your script, use the values of x and y to calculate the range of miles per gallon