import library

library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.1
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors

Necessary code

# put your code here that is necessary to finish the two assessable questions
cereal_df <- read.csv("C:/Users/18094/Desktop/5003/Cereal.csv", header = TRUE) 
cereal_tbl <- read_csv("Cereal.csv") 
## Rows: 77 Columns: 16
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (3): name, mfr, type
## dbl (13): calories, protein, fat, sodium, fiber, carbo, sugars, potass, vita...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

3.2 (c)

# put your code here
aggregate(cereal_df$sodium, by=list(type=cereal_df$mfr),mean)
##   type        x
## 1    A   0.0000
## 2    G 200.4545
## 3    K 174.7826
## 4    N  37.5000
## 5    P 146.1111
## 6    Q  92.5000
## 7    R 198.1250

4.1

# put your code here
data=cereal_df[,c("mfr","sodium")]
boxplot(sodium~mfr,data=data)