# Run this code to load the required packages
suppressMessages(suppressWarnings(suppressPackageStartupMessages({
library(mosaic)
library(supernova)
library(Lock5withR)
})))
# Adjust the plots to be a bit smaller
options(repr.plot.width = 6, repr.plot.height = 4)
CensusSchool <- read.csv("https://docs.google.com/spreadsheets/d/e/2PACX-1vSVaWnM4odSxy0mlnhWvvGbeLtiKoZmsbqC6KLzXtBOjQfrF9EVKuX4RVh3XbP3iw/pub?gid=2100178416&single=true&output=csv", header = TRUE)
str(CensusSchool)
filter(CensusSchool,Gender != "NA")
Census1 <- filter(CensusSchool,Gender != "NA")
gf_point(Sleep_Hours_Schoolnight ~ Gender, data = Census1, color = "Blue", bins= 5)
lm(Sleep_Hours_Schoolnight ~ Gender, data = Census1)
Census.clean <- filter(CensusSchool,Gender != "NA")
Sleep.model <- lm(Sleep_Hours_Schoolnight ~ Gender, data = Census1)
Census.clean$prediction <- predict(Sleep.model)
gf_jitter(Sleep_Hours_Schoolnight ~ Gender, data = Census1, width = .2, height = .2, alpha = .5, size = 4) %>%
gf_jitter(prediction ~ Gender, color = "orange", height = 1, width = .2)