Get startedGet started for free

Check dimension measurements

So far you have removed 2 cases with 0mm abalone heights which were measured incorrectly. You also removed 4 cases where shuckedWeight was larger than wholeWeight which is illogical probably due to recording errors. The abaloneKeep dataset loaded for this exercise now only has 4177 - 2 - 4 = 4171 cases.

Additionally, the relationship of the dimensional measurements also need to be reviewed. The length of the abalones (in mm) was defined to be the longest shell measurement. So, length should always be greater than height or diameter. Now, you will check this condition using a scatterplot with a Y=X reference line. You will then remove any cases that fail this length condition.

The abaloneKeep dataset, dplyr and ggplot2 packages are also loaded for you.

This exercise is part of the course

R For SAS Users

View Course

Exercise instructions

  • Make a scatterplot of length on x-axis and height on y-axis and add reference line Y=X with intercept 0 and slope 1.
  • Make a scatterplot of length on x-axis and diameter on y-axis and add reference line Y=X with intercept 0 and slope 1.
  • Update abaloneKeep to keep abalones with length greater than both height and diameter.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Make scatterplot of height by length add y=x line
ggplot(___) +
  ___ + 
  ___

# Make scatterplot of diameter by length add y=x line
ggplot(___) +
  ___ + 
  ___

# Keep abalones with length > both height and diameter
abaloneKeep <- abaloneKeep %>%
  filter((___) & (___))
Edit and Run Code