In Class Exercise 3

Author

Thomas Hoang Huy

Published

January 28, 2023

Modified

February 14, 2023

Installing and loading R packages

Two packages will be installed and loaded. They are tidyverse and ggiraph

pacman::p_load(tidyverse)
exam_data <- read_csv("data/Exam_data.csv")

Getting Started  Installing and loading R packages  Two packages will be install and loaded, they are: tidyverse, ggiraph. 

Always to load tidyverse last, to avoid any potential conflicts with tidyverse.

pacman::p_load(ggiraph, tidyverse)
exam_data <- read_csv('data/Exam_data.csv', show_col_types = FALSE)
ggplot(data = exam_data,
       aes(x = MATHS)) + geom_dotplot(dotsize = 0.5)

p <- ggplot(data = exam_data,
            aes(x = MATHS)) + geom_dotplot_interactive(aes(tooltip = ID),
                                                       stackgroups = TRUE,
                                                       binwidth = 2,
                                                       method = "histodot") + scale_y_continuous(NULL, breaks = NULL)

girafe(ggobj = p, width_svg = 10,height_svg =  10* 0.5)