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.
Cet exercice fait partie du cours
R For SAS Users
Instructions
- Make a scatterplot of
lengthon x-axis andheighton y-axis and add reference line Y=X with intercept 0 and slope 1. - Make a scatterplot of
lengthon x-axis anddiameteron y-axis and add reference line Y=X with intercept 0 and slope 1. - Update
abaloneKeepto keep abalones withlengthgreater than bothheightanddiameter.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de 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((___) & (___))