{r setup} library(reticulate) library(ggplot2) library(dplyr)
{python} import pandas as pd
df = pd.read_csv(“StudentPerformanceFactors.csv”) df.head()
{r} df <- py$df head(df)
{r} ggplot(df, aes(x = Exam_Score)) + geom_histogram(bins = 20, fill = “steelblue”) + theme_minimal() + labs(title = “Distribusi Nilai Ujian”)
{r} ggplot(df, aes(x = Hours_Studied, y = Exam_Score)) + geom_point() + geom_smooth(method = “lm”, se = FALSE) + theme_minimal() + labs(title = “Korelasi Jam Belajar vs Nilai Ujian”)
{r} df %>% group_by(Motivation_Level) %>% summarise(MeanScore = mean(Exam_Score)) %>% ggplot(aes(x = Motivation_Level, y = MeanScore, fill = Motivation_Level)) + geom_col() + theme_minimal() + labs(title = “Rata-rata Nilai Berdasarkan Motivation Level”)