First Markdown Files Inclass
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.3.6 ✔ purrr 0.3.4
## ✔ tibble 3.1.8 ✔ dplyr 1.0.9
## ✔ tidyr 1.2.0 ✔ stringr 1.4.1
## ✔ readr 2.1.2 ✔ forcats 0.5.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
library(readxl)
setwd("~/Data Study/Data 101 MC/Week7")
mnm <- read_excel("Class MnM Data.xlsx")
mnm
## # A tibble: 382 × 6
## student_id id color defect total weight_grams
## <chr> <dbl> <chr> <chr> <dbl> <dbl>
## 1 AP_LV 1 r c 27 40
## 2 AP_LV 2 r l 27 40
## 3 AP_LV 3 r z 27 40
## 4 AP_LV 4 r z 27 40
## 5 AP_LV 5 r z 27 40
## 6 AP_LV 6 o l 27 40
## 7 AP_LV 7 o z 27 40
## 8 AP_LV 8 o z 27 40
## 9 AP_LV 9 o z 27 40
## 10 AP_LV 10 o z 27 40
## # … with 372 more rows
names(mnm)
## [1] "student_id" "id" "color" "defect" "total"
## [6] "weight_grams"
colSums(is.na(mnm))
## student_id id color defect total weight_grams
## 0 0 0 0 0 0
class(mnm)
## [1] "tbl_df" "tbl" "data.frame"
head(mnm)
## # A tibble: 6 × 6
## student_id id color defect total weight_grams
## <chr> <dbl> <chr> <chr> <dbl> <dbl>
## 1 AP_LV 1 r c 27 40
## 2 AP_LV 2 r l 27 40
## 3 AP_LV 3 r z 27 40
## 4 AP_LV 4 r z 27 40
## 5 AP_LV 5 r z 27 40
## 6 AP_LV 6 o l 27 40
summary(mnm)
## student_id id color defect
## Length:382 Min. : 1.0 Length:382 Length:382
## Class :character 1st Qu.:10.0 Class :character Class :character
## Mode :character Median :20.0 Mode :character Mode :character
## Mean :22.8
## 3rd Qu.:35.0
## Max. :55.0
## total weight_grams
## Min. :18.00 Min. :25.00
## 1st Qu.:27.00 1st Qu.:40.00
## Median :54.00 Median :48.00
## Mean :45.01 Mean :44.25
## 3rd Qu.:55.00 3rd Qu.:50.00
## Max. :56.00 Max. :50.00
str(mnm)
## tibble [382 × 6] (S3: tbl_df/tbl/data.frame)
## $ student_id : chr [1:382] "AP_LV" "AP_LV" "AP_LV" "AP_LV" ...
## $ id : num [1:382] 1 2 3 4 5 6 7 8 9 10 ...
## $ color : chr [1:382] "r" "r" "r" "r" ...
## $ defect : chr [1:382] "c" "l" "z" "z" ...
## $ total : num [1:382] 27 27 27 27 27 27 27 27 27 27 ...
## $ weight_grams: num [1:382] 40 40 40 40 40 40 40 40 40 40 ...
hist(mnm$weight_grams)
IQR(mnm$weight_grams)
## [1] 10
fivenum(mnm$weight_grams)
## [1] 25 40 48 50 50