Skip to content

Day 1 or 2 Practice

Meghan Balk edited this page Mar 29, 2018 · 2 revisions
  1. Open a new file, save it as "Day_1_Practice.R"
  2. Import the dataset mtcars
  3. Look at the structure of the data. How many columns are there? How many types of cars?
  4. Calculate the average miles per gallon (mpg) - the long way. Save this as "avg.mpg". What is the value? What type of class is avg.mpg?
  5. Calculate the standard deviation of mpg - the long way. Can you string the arguments together in one line? What is the value of the standard deviation of mpg?
  6. How would you do (4) and (5) with a built-in function?

Be sure to annotate what you do as you go!