Summary Statistics of Abalones’ - Dimensional Measurements
library(arsenal)
tab1 <-
tableby(~ length + diameter + height,
data=abalone)
summary(tab1)
length |
|
Mean (SD) |
0.524 (0.120) |
Range |
0.075 - 0.815 |
diameter |
|
Mean (SD) |
0.408 (0.099) |
Range |
0.055 - 0.650 |
height |
|
Mean (SD) |
0.140 (0.042) |
Range |
0.000 - 1.130 |
Summary Statistics of Abalones’ - Weight Measurements
#library(arsenal)
# put in code here to get a table of summary stats
# for wholeWeight, shuckedWeight, visceraWeight
# and shellWeight
Abalone Dimensional Measurements by Sex
library(arsenal)
tab1 <-
tableby(sex ~ length + diameter + height,
data=abalone)
summary(tab1)
length |
|
|
|
|
< 0.001 |
Mean (SD) |
0.579 (0.086) |
0.428 (0.109) |
0.561 (0.103) |
0.524 (0.120) |
|
Range |
0.275 - 0.815 |
0.075 - 0.725 |
0.155 - 0.780 |
0.075 - 0.815 |
|
diameter |
|
|
|
|
< 0.001 |
Mean (SD) |
0.455 (0.071) |
0.326 (0.088) |
0.439 (0.084) |
0.408 (0.099) |
|
Range |
0.195 - 0.650 |
0.055 - 0.550 |
0.110 - 0.630 |
0.055 - 0.650 |
|
height |
|
|
|
|
< 0.001 |
Mean (SD) |
0.158 (0.040) |
0.108 (0.032) |
0.151 (0.035) |
0.140 (0.042) |
|
Range |
0.015 - 1.130 |
0.000 - 0.220 |
0.025 - 0.515 |
0.000 - 1.130 |
|
Abalone Weight Measurements by Sex
#library(arsenal)
# put in code here to get a table of summary stats
# for wholeWeight, shuckedWeight, visceraWeight
# and shellWeight
Plot of Abalone Age by wholeWeight
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
abalone <- abalone %>%
mutate(age = rings + 1.5)
library(ggplot2)
ggplot(abalone,
aes(x=wholeWeight,
y=rings)) +
geom_point() +
# add loess smoothed line
geom_smooth() +
xlab("Whole Weight (g)") +
ylab("Age (in years)") +
ggtitle("Abalone Age by Whole Weight")
## `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'

Plot of Abalone Age by diameter - by sex
Create a plot of abalone age by diameter in mm. Show the plot by sex
- either add a color by sex or a facet_wrap().
# put your code here