In Class 1

Author

Daisy

Published

February 26, 2023

Installing and loading the R packages

Two packages will be installed and loaded, they are Tidyverse and ggiraph

pacman::p_load(tidyverse,ggiraph)
examdata <- read_csv("Exam_data.csv")
p <- ggplot(data=examdata, 
       aes(x = MATHS)) +
  geom_dotplot_interactive(
    aes(tooltip = ID),
    stackgroups = TRUE, 
    binwidth = 1, 
    method = "histodot") +
  scale_y_continuous(NULL, 
                     breaks = NULL)
girafe(
  ggobj = p,
  width_svg = 6,
  height_svg = 6*0.618
)
d <- examdata   
d_bg <- d[, -3]  

ggplot(d, aes(x = ENGLISH, fill = GENDER)) +
  geom_histogram(data = d_bg, fill = "grey", alpha = .5) +
  geom_histogram(colour = "black") +
  facet_wrap(~ GENDER) +
  guides(fill = FALSE) +  
  theme_bw()