1. Learn
  2. /
  3. Courses
  4. /
  5. Support Vector Machines in R

Exercise

Visualizing a sugar content dataset

In this exercise, you will create a 1-dimensional scatter plot of 25 soft drink sugar content measurements. The aim is to visualize distinct clusters in the dataset as a first step towards identifying candidate decision boundaries.

The dataset with 25 sugar content measurements is stored in the sugar_content column of the data frame df, which has been preloaded for you.

Instructions

100 XP
  • Load the ggplot2 package.
  • List the variables in dataframe df.
  • Complete the scatter plot code. Using the df dataset, plot the sugar content of samples along the x-axis (at y equal to zero).
  • Write ggplot() code to display sugar content in df as a scatter plot. Can you spot two distinct clusters corresponding to high and low sugar content samples?