# Installing required packages
if (!require("tidyverse")) install.packages("tidyverse")
## Loading required package: 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.4.4     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.0
## ✔ 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
if (!require("ggrepel")) install.packages("ggrepel")
## Loading required package: ggrepel
if (!require("nflreadr")) install.packages("nflreadr")
## Loading required package: nflreadr
if (!require("nflplotR")) install.packages("nflplotR")
## Loading required package: nflplotR
library(tidyverse)
library(ggrepel)
library(nflreadr)
library(nflplotR)
library(ggplot2)
mydata <- read.csv("https://raw.githubusercontent.com/drkblake/Data/main/DormTemps.csv")

mydata$Var <- mydata$RoomTemp
test_value = 70.0

ggplot(mydata, aes(x= Var)) +
  geom_histogram(color = "black", fill = "blue") +
  geom_vline(aes(xintercept = mean(Var))) 
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

mydata %>%
  select(Var) %>%
  summarise(
    count = n(),
    mean = mean(Var, na.rm = TRUE),
    sd = sd(Var, na.rm = TRUE),
    min = min(Var, na.rm = TRUE),
    max = max(Var, na.rm = TRUE),
    `W Statistic` = shapiro.test(Var)$statistic,
    `p-value` = shapiro.test(Var)$p.value)
##   count     mean       sd min max W Statistic   p-value
## 1   175 62.73486 3.957923  53  76   0.9884747 0.1650714
t.test(mydata$Var, mu = test_value)
## 
##  One Sample t-test
## 
## data:  mydata$Var
## t = -24.283, df = 174, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 70
## 95 percent confidence interval:
##  62.14435 63.32537
## sample estimates:
## mean of x 
##  62.73486
if (!require("tidyverse"))
  install.packages("tidyverse")
if (!require("gmodels"))
  
library(gmodels)
## Loading required package: gmodels
library(tidyverse)

CrossTable(
  mydata$Var,
  prop.chisq = FALSE,
  prop.t = FALSE,
  prop.r = FALSE)
## 
##  
##    Cell Contents
## |-------------------------|
## |                       N |
## |-------------------------|
## 
##  
## Total Observations in Table:  175 
## 
##  
##           |        53 |      54.3 |      54.6 |      55.2 |      56.2 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         1 |         1 |         1 |         1 |         1 | 
##           |     0.006 |     0.006 |     0.006 |     0.006 |     0.006 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      56.3 |      56.4 |      56.5 |      56.8 |      56.9 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         1 |         1 |         1 |         1 |         1 | 
##           |     0.006 |     0.006 |     0.006 |     0.006 |     0.006 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |        57 |      57.3 |      57.4 |      57.7 |      57.8 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         1 |         1 |         2 |         1 |         1 | 
##           |     0.006 |     0.006 |     0.011 |     0.006 |     0.006 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      57.9 |        58 |      58.1 |      58.3 |      58.4 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         2 |         2 |         1 |         1 |         1 | 
##           |     0.011 |     0.011 |     0.006 |     0.006 |     0.006 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      58.5 |      58.6 |      58.8 |      58.9 |        59 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         1 |         1 |         1 |         1 |         1 | 
##           |     0.006 |     0.006 |     0.006 |     0.006 |     0.006 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      59.3 |      59.4 |      59.5 |      59.6 |      59.7 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         2 |         1 |         2 |         2 |         3 | 
##           |     0.011 |     0.006 |     0.011 |     0.011 |     0.017 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      59.8 |      59.9 |        60 |      60.3 |      60.4 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         4 |         4 |         1 |         3 |         1 | 
##           |     0.023 |     0.023 |     0.006 |     0.017 |     0.006 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      60.5 |      60.7 |      60.8 |      60.9 |        61 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         2 |         2 |         3 |         2 |         3 | 
##           |     0.011 |     0.011 |     0.017 |     0.011 |     0.017 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      61.1 |      61.3 |      61.4 |      61.5 |      61.6 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         3 |         3 |         4 |         1 |         2 | 
##           |     0.017 |     0.017 |     0.023 |     0.006 |     0.011 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      61.7 |      61.8 |      61.9 |      62.1 |      62.2 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         1 |         2 |         2 |         1 |         5 | 
##           |     0.006 |     0.011 |     0.011 |     0.006 |     0.029 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      62.3 |      62.4 |      62.5 |      62.6 |      62.7 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         1 |         4 |         1 |         1 |         4 | 
##           |     0.006 |     0.023 |     0.006 |     0.006 |     0.023 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      62.8 |      62.9 |        63 |      63.2 |      63.3 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         1 |         1 |         2 |         2 |         3 | 
##           |     0.006 |     0.006 |     0.011 |     0.011 |     0.017 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      63.5 |      63.6 |      63.7 |      63.9 |        64 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         1 |         2 |         3 |         1 |         1 | 
##           |     0.006 |     0.011 |     0.017 |     0.006 |     0.006 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      64.2 |      64.3 |      64.4 |      64.5 |      64.7 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         3 |         1 |         2 |         1 |         1 | 
##           |     0.017 |     0.006 |     0.011 |     0.006 |     0.006 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      64.8 |      64.9 |        65 |      65.1 |      65.2 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         2 |         1 |         1 |         2 |         4 | 
##           |     0.011 |     0.006 |     0.006 |     0.011 |     0.023 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      65.4 |      65.5 |      65.6 |        66 |      66.1 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         1 |         1 |         2 |         2 |         2 | 
##           |     0.006 |     0.006 |     0.011 |     0.011 |     0.011 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      66.2 |      66.3 |      66.4 |      66.6 |      66.7 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         2 |         1 |         1 |         1 |         1 | 
##           |     0.011 |     0.006 |     0.006 |     0.006 |     0.006 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      66.8 |        67 |      67.1 |      67.2 |      67.3 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         1 |         2 |         1 |         1 |         2 | 
##           |     0.006 |     0.011 |     0.006 |     0.006 |     0.011 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      67.4 |      67.5 |      67.7 |      67.9 |      68.7 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         1 |         1 |         1 |         2 |         2 | 
##           |     0.006 |     0.006 |     0.006 |     0.011 |     0.011 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      69.4 |      69.6 |      69.7 |      69.9 |      70.3 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         3 |         1 |         1 |         1 |         1 | 
##           |     0.017 |     0.006 |     0.006 |     0.006 |     0.006 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      70.4 |      70.7 |        71 |      71.4 |      71.5 | 
##           |-----------|-----------|-----------|-----------|-----------|
##           |         1 |         1 |         1 |         1 |         1 | 
##           |     0.006 |     0.006 |     0.006 |     0.006 |     0.006 | 
##           |-----------|-----------|-----------|-----------|-----------|
## 
## 
##           |      72.9 |        76 | 
##           |-----------|-----------|
##           |         1 |         1 | 
##           |     0.006 |     0.006 | 
##           |-----------|-----------|
## 
## 
## 
##