Session Ready
Exercise

Exploring the data

One of the first things to do with new datasets is to plot it prior to analysis. During this exercise, you will plot the data using ggplot2 and create a publication quality figure. This will help you to see the data.

This data examines if two different drugs change the amount of sleep individuals get. The response variable of interest is the amount of extra sleep a patient gets. The predictor variable is the drug group. The ID of each patient allows us to do a repeated measures analysis. This is a random-effect intercept and corresponds to the baseline effect of giving a person a sleeping drug. We do not care how much an individuals sleeps in this case, only the change in sleep of the groups.

The data.frame sleep contains these variables.

Instructions 1/3
undefined XP
  • 1
  • 2
  • 3
  • Plot the raw data points using ggplot2.
  • extra is the y variable and group is the x variable with the sleep data.frame.