In-class Exercise 4

Author

Oh Jia Wen

Published

May 6, 2023

Modified

May 6, 2023

Getting started

  1. Using p_load() of pacman package to load the required libraries
pacman::p_load(rstatix,gt,patchwork,tidyverse,webshot2,png)
  1. Importing data
exam_data <- read_csv("data/Exam_data.csv")

Plotting the graph

1) Visualizing statistical graph QQ Plot

The quantile-quantile (q-q) plot is a graphical technique for determining if two data sets come from populations with a common distribution.

ggplot(exam_data,
       aes(sample=ENGLISH)) +
  stat_qq() +
  stat_qq_line()

2) Combining statistical graph and analysis table

qq <- ggplot(exam_data,
       aes(sample=ENGLISH)) +
  stat_qq() +
  stat_qq_line()

sw_t <- exam_data %>%
  shapiro_test(ENGLISH) %>%
  gt()

tmp <-tempfile(fileext = ".png")
gtsave(sw_t,tmp)
table_png <- png::readPNG(tmp,
native= TRUE)

qq + table_png