Learning Outcomes

By the end of this tutorial, you should be able to:

  1. Load and explore the built-in dataset in R.

  2. Summarize and visualize data using ggplot2.

  3. Work as a group to describe the relationships in data.

  4. Produce an HTML report in R Markdown.

Instructions

In your groups, answer the following questions based on your assigned data set (see sections below).

Work together to create a R Markdown HTML output that includes figures created using ggplot2, which you will later present to the class.

Note. You can install ggplot2 either by installing the tidyverse package collection (recommended) or the ggplot2 package alone. Package installation only needs to be done once. Remember to load the packages after installing them.

library(ggplot2)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Groupings

Group 1 (Motor Trend Car Road Tests)

Load the ‘mtcars’ data set using this code:

{data(mtcars)}

  1. Describe and summarize your assigned data set.
  2. Graph your data and explore the relationship between car weight (wt) and miles per gallon (mpg)?
  3. Do cars with more cylinders (cyl) consume more fuel?

Group 2 (ToothGrowth)

Load the ‘toothGrowth’ data set using this code:

{data(ToothGrowth)}

  1. Describe and summarize your assigned data set.
  2. Does tooth length increase with dosage?
  3. Which supplement type (VC or OJ) is more effective?
  4. Graph your data and explore the relationship between dose and supplement.

Group 3 (PlantGrowth)

Load the ‘PlantGrowth’ data set using this code:

{data(PlantGrowth)}

  1. Describe and summarize your assigned data set.
  2. Do different treatments affect plant weight? Graph your data.
  3. Which treatment has the highest average growth?

Group 4 (USArrests)

Load the ‘USArrests’ data set using this code:

{data(USArrests)}

  1. Describe and summarize your assigned data set.
  2. Which states have the highest murder and assault rates?
  3. Is there a relationship between urban population percentage and crime rates? Graph your data.

Group 5 (Iris Data)

Load the ‘iris’ data set using this code:

{data(iris)}

  1. Describe and summarize your assigned data set.
  2. How do petal length and petal width vary across species?
  3. Graph the petal dimension across Iris species. Are sepal dimensions correlated with petal dimensions?

Wrap-up