This is the result of my data analysis using R studio regarding the test scores of twenty students
library(readr)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ purrr 1.1.0
## ✔ forcats 1.0.1 ✔ stringr 1.5.2
## ✔ ggplot2 4.0.0 ✔ tibble 3.3.0
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
UTS_Mike_Zidane <- read_csv("C:/Users/Michael Zidane/Downloads/UTS Mike Zidane.csv")
## Rows: 20 Columns: 6
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): student_id
## dbl (5): hours_studied, sleep_hours, attendance_percent, previous_scores, ex...
##
## ℹ 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.
View(UTS_Mike_Zidane)
print(UTS_Mike_Zidane)
## # A tibble: 20 × 6
## student_id hours_studied sleep_hours attendance_percent previous_scores
## <chr> <dbl> <dbl> <dbl> <dbl>
## 1 S001 8 8.8 72.1 45
## 2 S002 1.3 8.6 60.7 55
## 3 S003 4 8.2 73.7 86
## 4 S004 3.5 4.8 95.1 66
## 5 S005 9.1 6.4 89.8 71
## 6 S006 8.4 5.1 58.5 75
## 7 S007 10.8 6 54.2 88
## 8 S008 2 4.3 75.8 55
## 9 S009 5.6 5.9 81.6 84
## 10 S010 1.3 8.9 66.8 70
## 11 S011 3.4 5.3 90.9 81
## 12 S012 6.6 7.9 87.6 85
## 13 S013 1.3 6.3 83.6 71
## 14 S014 3.2 6.1 61.2 68
## 15 S015 8.1 8.8 60 90
## 16 S016 7 9 51.2 41
## 17 S017 3.4 6.8 62.2 45
## 18 S018 7.5 7.6 73.8 58
## 19 S019 9.9 4.8 92.5 54
## 20 S020 1.1 5.5 53.6 65
## # ℹ 1 more variable: exam_score <dbl>
summary(UTS_Mike_Zidane)
## student_id hours_studied sleep_hours attendance_percent
## Length:20 Min. : 1.100 Min. :4.300 Min. :51.20
## Class :character 1st Qu.: 2.900 1st Qu.:5.450 1st Qu.:60.52
## Mode :character Median : 4.800 Median :6.350 Median :72.90
## Mean : 5.275 Mean :6.755 Mean :72.25
## 3rd Qu.: 8.025 3rd Qu.:8.300 3rd Qu.:84.60
## Max. :10.800 Max. :9.000 Max. :95.10
## previous_scores exam_score
## Min. :41.00 Min. :17.10
## 1st Qu.:55.00 1st Qu.:29.20
## Median :69.00 Median :34.05
## Mean :67.65 Mean :31.77
## 3rd Qu.:81.75 3rd Qu.:35.73
## Max. :90.00 Max. :41.10
mean(UTS_Mike_Zidane$hours_studied)
## [1] 5.275
median(UTS_Mike_Zidane$hours_studied)
## [1] 4.8
names(sort((-table(UTS_Mike_Zidane$hours_studied))))[1]
## [1] "1.3"
summary(UTS_Mike_Zidane)
## student_id hours_studied sleep_hours attendance_percent
## Length:20 Min. : 1.100 Min. :4.300 Min. :51.20
## Class :character 1st Qu.: 2.900 1st Qu.:5.450 1st Qu.:60.52
## Mode :character Median : 4.800 Median :6.350 Median :72.90
## Mean : 5.275 Mean :6.755 Mean :72.25
## 3rd Qu.: 8.025 3rd Qu.:8.300 3rd Qu.:84.60
## Max. :10.800 Max. :9.000 Max. :95.10
## previous_scores exam_score
## Min. :41.00 Min. :17.10
## 1st Qu.:55.00 1st Qu.:29.20
## Median :69.00 Median :34.05
## Mean :67.65 Mean :31.77
## 3rd Qu.:81.75 3rd Qu.:35.73
## Max. :90.00 Max. :41.10
mean(UTS_Mike_Zidane$sleep_hours)
## [1] 6.755
median(UTS_Mike_Zidane$sleep_hours)
## [1] 6.35
names(sort(-table(UTS_Mike_Zidane)))[1]
## NULL
summary(UTS_Mike_Zidane)
## student_id hours_studied sleep_hours attendance_percent
## Length:20 Min. : 1.100 Min. :4.300 Min. :51.20
## Class :character 1st Qu.: 2.900 1st Qu.:5.450 1st Qu.:60.52
## Mode :character Median : 4.800 Median :6.350 Median :72.90
## Mean : 5.275 Mean :6.755 Mean :72.25
## 3rd Qu.: 8.025 3rd Qu.:8.300 3rd Qu.:84.60
## Max. :10.800 Max. :9.000 Max. :95.10
## previous_scores exam_score
## Min. :41.00 Min. :17.10
## 1st Qu.:55.00 1st Qu.:29.20
## Median :69.00 Median :34.05
## Mean :67.65 Mean :31.77
## 3rd Qu.:81.75 3rd Qu.:35.73
## Max. :90.00 Max. :41.10
mean(UTS_Mike_Zidane$attendance_percent)
## [1] 72.245
median(UTS_Mike_Zidane$attendance_percent)
## [1] 72.9
names(sort(-table(UTS_Mike_Zidane)))[1]
## NULL
summary(UTS_Mike_Zidane)
## student_id hours_studied sleep_hours attendance_percent
## Length:20 Min. : 1.100 Min. :4.300 Min. :51.20
## Class :character 1st Qu.: 2.900 1st Qu.:5.450 1st Qu.:60.52
## Mode :character Median : 4.800 Median :6.350 Median :72.90
## Mean : 5.275 Mean :6.755 Mean :72.25
## 3rd Qu.: 8.025 3rd Qu.:8.300 3rd Qu.:84.60
## Max. :10.800 Max. :9.000 Max. :95.10
## previous_scores exam_score
## Min. :41.00 Min. :17.10
## 1st Qu.:55.00 1st Qu.:29.20
## Median :69.00 Median :34.05
## Mean :67.65 Mean :31.77
## 3rd Qu.:81.75 3rd Qu.:35.73
## Max. :90.00 Max. :41.10
mean(UTS_Mike_Zidane$previous_scores)
## [1] 67.65
median(UTS_Mike_Zidane$previous_scores)
## [1] 69
names(sort(-table(UTS_Mike_Zidane)))[1]
## NULL
summary(UTS_Mike_Zidane)
## student_id hours_studied sleep_hours attendance_percent
## Length:20 Min. : 1.100 Min. :4.300 Min. :51.20
## Class :character 1st Qu.: 2.900 1st Qu.:5.450 1st Qu.:60.52
## Mode :character Median : 4.800 Median :6.350 Median :72.90
## Mean : 5.275 Mean :6.755 Mean :72.25
## 3rd Qu.: 8.025 3rd Qu.:8.300 3rd Qu.:84.60
## Max. :10.800 Max. :9.000 Max. :95.10
## previous_scores exam_score
## Min. :41.00 Min. :17.10
## 1st Qu.:55.00 1st Qu.:29.20
## Median :69.00 Median :34.05
## Mean :67.65 Mean :31.77
## 3rd Qu.:81.75 3rd Qu.:35.73
## Max. :90.00 Max. :41.10
mean(UTS_Mike_Zidane$exam_score)
## [1] 31.775
names(sort(-table(UTS_Mike_Zidane)))[1]
## NULL
sleep_hours <- c(UTS_Mike_Zidane$sleep_hours)
exam_score <- c(UTS_Mike_Zidane$exam_score)
barplot(sleep_hours, names.arg = exam_score, col = "pink" ,main = "Relationship between sleep hours and exam score")
# Relationship between Hours Studied and exam score
hours_studied <- c(UTS_Mike_Zidane$hours_studied)
exam_score <- c(UTS_Mike_Zidane$exam_score)
barplot(hours_studied, names.arg = exam_score, col = "green" ,main = "Relationship between hours studied and exam score")
# Relationship between Attendance Percent and exam score
attendance_percent <- c(UTS_Mike_Zidane$attendance_percent)
exam_score <- c(UTS_Mike_Zidane$exam_score)
barplot(attendance_percent, names.arg = exam_score, col = "red", main = "Relationship between attendance percent and exam score")
# # Relationship between Previous score and exam score
previous_score <- c(UTS_Mike_Zidane$attendance_percent)
exam_score <- c(UTS_Mike_Zidane$exam_score)
barplot(previous_score, names.arg = exam_score, col = "blue" ,main = "Relationship between Previous Score and exam score")