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
Exercise instructions
- Arrange
abaloneKeep
bypctShucked
, pullpctShucked
fromabaloneKeep
and view bottom 6 rows. - Make
scatterplot
ofwholeWeight
on x-axis andshuckedWeight
on y-axis, addgeom_abline()
with intercept 0 and slope 1. - Keep cases where
shuckedWeight
is less thanwholeWeight
usingfilter()
fromdplyr
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 %>%
___