# Load necessary libraries
pacman::p_load(pacman, ggplot2, igraph, dplyr, readr)
# Load datasets
paradox_data <- read_csv("paradox_data.csv")
## Rows: 7 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): Paradox
## dbl (1): Frequency
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
timeline_data <- read_csv("timeline_data.csv")
## Rows: 8 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (3): Time (min), Teacher A Engagement, Teacher B Engagement
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
network_data <- read_csv("teacher_student_network.csv")
## Rows: 10 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Teacher, Interaction
## dbl (1): Strength
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
comparison_data <- read_csv("comparison_data.csv")
## Rows: 4 Columns: 3
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): Category
## dbl (2): Teacher A Score, Teacher B Score
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
# 1. Bar Chart for Didactic Paradox Frequency
# This chart visualises the prevalence of different didactic paradoxes observed in the study.
# It helps highlight which paradoxes occur most frequently in the teaching of Euclid’s Theorems.
ggplot(paradox_data, aes(x=reorder(Paradox, -Frequency), y=Frequency, fill=Paradox)) +
geom_bar(stat="identity") +
coord_flip() +
labs(title="Chart 1: Frequency of Didactic Paradoxes",
x="Paradox Type",
y="Count") +
theme_minimal() +
theme(axis.title = element_text(face="bold"),
axis.text = element_text(face="bold")) # Bold axis labels

# 2. Line Chart for Teacher-Student Interaction Timeline
# This chart tracks how the level of teacher engagement varies over time.
# It reveals how actively teachers interact with students and whether engagement levels decline over the session.
ggplot(timeline_data, aes(x=`Time (min)`)) +
geom_line(aes(y=`Teacher A Engagement`, color="Teacher A"), linewidth=1) +
geom_line(aes(y=`Teacher B Engagement`, color="Teacher B"), linewidth=1) +
labs(title="Chart 2: Teacher-Student Interaction Over Time",
x="Time (minutes)",
y="Engagement Level") +
theme_minimal() +
theme(axis.title = element_text(face="bold"),
axis.text = element_text(face="bold")) # Bold axis labels

# Create an edge list for the network
graph_edges <- data.frame(from = network_data$Teacher,
to = network_data$Interaction,
weight = network_data$Strength)
# Create the graph object
interaction_graph <- graph_from_data_frame(graph_edges, directed = FALSE)
# Plot the network graph
plot(interaction_graph,
vertex.size = 15,
vertex.label.cex = 1.1,
vertex.label.font = 2, # Bold node text
edge.width = E(interaction_graph)$weight / 2, # Scale edge width by strength
main = "Chart 3: Teacher-Student Interaction Network")

# 4. Comparison Chart for Teaching Methods
# This chart compares different teaching approaches used by Teacher A and Teacher B.
# It helps assess which teacher utilises a more interactive and effective teaching methodology.
ggplot(comparison_data, aes(x=Category)) +
geom_bar(aes(y=`Teacher A Score`, fill="Teacher A"), stat="identity", position="dodge") +
geom_bar(aes(y=`Teacher B Score`, fill="Teacher B"), stat="identity", position="dodge") +
labs(title="Chart 4: Comparison of Teaching Methods",
x="Teaching Aspects",
y="Score") +
theme_minimal() +
theme(axis.title = element_text(face="bold"),
axis.text = element_text(face="bold")) # Bold axis labels
