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.
Deze oefening maakt deel uit van de cursus
R For SAS Users
Oefeninstructies
- Arrange
abaloneKeepbypctShucked, pullpctShuckedfromabaloneKeepand view bottom 6 rows. - Make
scatterplotofwholeWeighton x-axis andshuckedWeighton y-axis, addgeom_abline()with intercept 0 and slope 1. - Keep cases where
shuckedWeightis less thanwholeWeightusingfilter()fromdplyrpackage.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# 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 %>%
___