Get startedGet started for free

Illogical weights

Removing abalones that had 0 mm heights was just the beginning. In this exercise, you will also investigate the component weights for the abalones. The wholeWeight is the total weight of the abalones in grams and includes the weight of the abalone meat as well as the shell. Thus, wholeWeight should be larger than shuckedWeight, visceraWeight and shellWeight.

As you saw in an earlier exercise there were a few pctShucked that were greater than 100% indicating cases where the shuckedWeight was greater than wholeWeight. In this exercise you will review and visualize these cases and then remove them from the dataset, abaloneKeep. abaloneKeep is loaded from the last exercise as well as the dplyr and ggplot2 packages.

This exercise is part of the course

R For SAS Users

View Course

Exercise instructions

  • Arrange abaloneKeep by pctShucked, pull pctShucked from abaloneKeep and view bottom 6 rows.
  • Make scatterplot of wholeWeight on x-axis and shuckedWeight on y-axis, add geom_abline() with intercept 0 and slope 1.
  • Keep cases where shuckedWeight is less than wholeWeight using filter() from dplyr package.

Hands-on interactive exercise

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

# Sort abaloneKeep by pctShucked, view largest 6 pctShucked
abaloneKeep %>%
  ___ %>%
  ___ %>%
  ___

# Scatterplot of shuckedWeight by wholeWeight add y=x line
ggplot(___) +
  ___ +
  ___

# Keep cases where shuckedWeight is less than wholeWeight
abaloneKeep <- abaloneKeep %>%
  ___
Edit and Run Code