# Set a CRAN mirror
options(repos = c(CRAN = "https://cran.rstudio.com"))
# Install required packages
if (!requireNamespace("readr", quietly = TRUE)) {
install.packages("readr")
}
# Load the required packages
library(readr)Final Project: Independent Data Intensive Research
ETR537
Prepare
The data set I tried to look for is about students’ learning analytics. I used the website kaggle.com that provided in Blackboard. At first, I tried to find the data set about art education/analytics, but I only find some data set about art museum. And I want to apply the knowledge I learned from ETR 537 through this project, this data set is about the Open University Learning Analytics.
The research question around this data set is:
“Does there any relationship between students final results and studied credits?”
Variables
The raw data came from the website – https://www.kaggle.com/datasets/rocki37/open-university-learning-analytics-dataset
It is about the Open University Learning Analytics:
View of the assessments, courses, studentAssessment, studentInfo, studentRegistration, studentVle, and vle.
Wrangle
assessments <- read_csv("archive/assessments.csv")Rows: 206 Columns: 6
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (3): code_module, code_presentation, assessment_type
dbl (3): id_assessment, date, weight
ℹ 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.
print(assessments)# A tibble: 206 × 6
code_module code_presentation id_assessment assessment_type date weight
<chr> <chr> <dbl> <chr> <dbl> <dbl>
1 AAA 2013J 1752 TMA 19 10
2 AAA 2013J 1753 TMA 54 20
3 AAA 2013J 1754 TMA 117 20
4 AAA 2013J 1755 TMA 166 20
5 AAA 2013J 1756 TMA 215 30
6 AAA 2013J 1757 Exam NA 100
7 AAA 2014J 1758 TMA 19 10
8 AAA 2014J 1759 TMA 54 20
9 AAA 2014J 1760 TMA 117 20
10 AAA 2014J 1761 TMA 166 20
# ℹ 196 more rows
courses <- read_csv("archive/courses.csv")Rows: 22 Columns: 3
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (2): code_module, code_presentation
dbl (1): module_presentation_length
ℹ 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.
print(courses)# A tibble: 22 × 3
code_module code_presentation module_presentation_length
<chr> <chr> <dbl>
1 AAA 2013J 268
2 AAA 2014J 269
3 BBB 2013J 268
4 BBB 2014J 262
5 BBB 2013B 240
6 BBB 2014B 234
7 CCC 2014J 269
8 CCC 2014B 241
9 DDD 2013J 261
10 DDD 2014J 262
# ℹ 12 more rows
studentAssessment <- read_csv("archive/studentAssessment.csv")Rows: 173912 Columns: 5
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
dbl (5): id_assessment, id_student, date_submitted, is_banked, 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.
print(studentAssessment)# A tibble: 173,912 × 5
id_assessment id_student date_submitted is_banked score
<dbl> <dbl> <dbl> <dbl> <dbl>
1 1752 11391 18 0 78
2 1752 28400 22 0 70
3 1752 31604 17 0 72
4 1752 32885 26 0 69
5 1752 38053 19 0 79
6 1752 45462 20 0 70
7 1752 45642 18 0 72
8 1752 52130 19 0 72
9 1752 53025 9 0 71
10 1752 57506 18 0 68
# ℹ 173,902 more rows
studentInfo <- read_csv("archive/studentInfo.csv")Rows: 32593 Columns: 12
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (9): code_module, code_presentation, gender, region, highest_education, ...
dbl (3): id_student, num_of_prev_attempts, studied_credits
ℹ 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.
print(studentInfo)# A tibble: 32,593 × 12
code_module code_presentation id_student gender region highest_education
<chr> <chr> <dbl> <chr> <chr> <chr>
1 AAA 2013J 11391 M East Angli… HE Qualification
2 AAA 2013J 28400 F Scotland HE Qualification
3 AAA 2013J 30268 F North West… A Level or Equiv…
4 AAA 2013J 31604 F South East… A Level or Equiv…
5 AAA 2013J 32885 F West Midla… Lower Than A Lev…
6 AAA 2013J 38053 M Wales A Level or Equiv…
7 AAA 2013J 45462 M Scotland HE Qualification
8 AAA 2013J 45642 F North West… A Level or Equiv…
9 AAA 2013J 52130 F East Angli… A Level or Equiv…
10 AAA 2013J 53025 M North Regi… Post Graduate Qu…
# ℹ 32,583 more rows
# ℹ 6 more variables: imd_band <chr>, age_band <chr>,
# num_of_prev_attempts <dbl>, studied_credits <dbl>, disability <chr>,
# final_result <chr>
studentRegistration <- read_csv("archive/studentRegistration.csv")Rows: 32593 Columns: 5
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (2): code_module, code_presentation
dbl (3): id_student, date_registration, date_unregistration
ℹ 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.
print(studentRegistration)# A tibble: 32,593 × 5
code_module code_presentation id_student date_registration
<chr> <chr> <dbl> <dbl>
1 AAA 2013J 11391 -159
2 AAA 2013J 28400 -53
3 AAA 2013J 30268 -92
4 AAA 2013J 31604 -52
5 AAA 2013J 32885 -176
6 AAA 2013J 38053 -110
7 AAA 2013J 45462 -67
8 AAA 2013J 45642 -29
9 AAA 2013J 52130 -33
10 AAA 2013J 53025 -179
# ℹ 32,583 more rows
# ℹ 1 more variable: date_unregistration <dbl>
studentVle <- read_csv("archive/studentVle.csv")Rows: 10655280 Columns: 6
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (2): code_module, code_presentation
dbl (4): id_student, id_site, date, sum_click
ℹ 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.
print(studentVle)# A tibble: 10,655,280 × 6
code_module code_presentation id_student id_site date sum_click
<chr> <chr> <dbl> <dbl> <dbl> <dbl>
1 AAA 2013J 28400 546652 -10 4
2 AAA 2013J 28400 546652 -10 1
3 AAA 2013J 28400 546652 -10 1
4 AAA 2013J 28400 546614 -10 11
5 AAA 2013J 28400 546714 -10 1
6 AAA 2013J 28400 546652 -10 8
7 AAA 2013J 28400 546876 -10 2
8 AAA 2013J 28400 546688 -10 15
9 AAA 2013J 28400 546662 -10 17
10 AAA 2013J 28400 546890 -10 1
# ℹ 10,655,270 more rows
vle <- read_csv("archive/vle.csv")Rows: 6364 Columns: 6
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (3): code_module, code_presentation, activity_type
dbl (3): id_site, week_from, week_to
ℹ 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.
print(vle)# A tibble: 6,364 × 6
id_site code_module code_presentation activity_type week_from week_to
<dbl> <chr> <chr> <chr> <dbl> <dbl>
1 546943 AAA 2013J resource NA NA
2 546712 AAA 2013J oucontent NA NA
3 546998 AAA 2013J resource NA NA
4 546888 AAA 2013J url NA NA
5 547035 AAA 2013J resource NA NA
6 546614 AAA 2013J homepage NA NA
7 546897 AAA 2013J url NA NA
8 546678 AAA 2013J oucontent NA NA
9 546933 AAA 2013J resource NA NA
10 546708 AAA 2013J oucontent NA NA
# ℹ 6,354 more rows
Wrangle
Viewing and/or inspecting data
final_result<-read_csv("archive/studentInfo.csv")Rows: 32593 Columns: 12
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (9): code_module, code_presentation, gender, region, highest_education, ...
dbl (3): id_student, num_of_prev_attempts, studied_credits
ℹ 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.
head(studentRegistration)# A tibble: 6 × 5
code_module code_presentation id_student date_registration date_unregistration
<chr> <chr> <dbl> <dbl> <dbl>
1 AAA 2013J 11391 -159 NA
2 AAA 2013J 28400 -53 NA
3 AAA 2013J 30268 -92 12
4 AAA 2013J 31604 -52 NA
5 AAA 2013J 32885 -176 NA
6 AAA 2013J 38053 -110 NA
tail(studentRegistration)# A tibble: 6 × 5
code_module code_presentation id_student date_registration date_unregistration
<chr> <chr> <dbl> <dbl> <dbl>
1 GGG 2014J 2620947 -23 NA
2 GGG 2014J 2640965 -4 NA
3 GGG 2014J 2645731 -23 NA
4 GGG 2014J 2648187 -129 NA
5 GGG 2014J 2679821 -49 101
6 GGG 2014J 2684003 -28 NA
Selecting Variables
library(dplyr)
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
student_info<-studentInfo%>%
select(code_module, gender, studied_credits, imd_band, final_result)course_data<-data.frame(module_presentation_length=c(10,15,20),
code_module=c("A", "B","C"),
sum_click=c(100, 150, 200))student_info|>
filter(studied_credits>60)# A tibble: 12,025 × 5
code_module gender studied_credits imd_band final_result
<chr> <chr> <dbl> <chr> <chr>
1 AAA M 240 90-100% Pass
2 AAA F 120 90-100% Pass
3 AAA F 90 70-80% Pass
4 AAA M 150 10-20 Fail
5 AAA M 120 30-40% Pass
6 AAA F 180 40-50% Pass
7 AAA F 120 80-90% Pass
8 AAA F 180 20-30% Withdrawn
9 AAA F 240 30-40% Pass
10 AAA M 345 90-100% Withdrawn
# ℹ 12,015 more rows
student_info|>
filter(final_result>"pass")# A tibble: 22,517 × 5
code_module gender studied_credits imd_band final_result
<chr> <chr> <dbl> <chr> <chr>
1 AAA M 240 90-100% Pass
2 AAA F 60 20-30% Pass
3 AAA F 60 30-40% Withdrawn
4 AAA F 60 50-60% Pass
5 AAA F 60 50-60% Pass
6 AAA M 60 80-90% Pass
7 AAA M 60 30-40% Pass
8 AAA F 120 90-100% Pass
9 AAA F 90 70-80% Pass
10 AAA M 60 <NA> Pass
# ℹ 22,507 more rows
student_info|>
select(studied_credits, final_result)|>
arrange(desc(studied_credits))# A tibble: 32,593 × 2
studied_credits final_result
<dbl> <chr>
1 655 Withdrawn
2 630 Pass
3 585 Withdrawn
4 540 Withdrawn
5 480 Withdrawn
6 430 Pass
7 420 Pass
8 400 Withdrawn
9 400 Withdrawn
10 390 Withdrawn
# ℹ 32,583 more rows
student_info|>
select(code_module, studied_credits, final_result)|>
arrange(desc(final_result))# A tibble: 32,593 × 3
code_module studied_credits final_result
<chr> <dbl> <chr>
1 AAA 60 Withdrawn
2 AAA 60 Withdrawn
3 AAA 60 Withdrawn
4 AAA 60 Withdrawn
5 AAA 60 Withdrawn
6 AAA 180 Withdrawn
7 AAA 60 Withdrawn
8 AAA 345 Withdrawn
9 AAA 90 Withdrawn
10 AAA 60 Withdrawn
# ℹ 32,583 more rows
install.packages("tidyr", version = "0.8.3")
The downloaded binary packages are in
/var/folders/55/wts59gf53ygdkrq0kb6bqpg80000gn/T//RtmpneJr9L/downloaded_packages
library(tidyr)
result <- studentAssessment %>%
gather(key = "score", value = "n", 1, 5)Analyze
Process Data
Before processing the data, I needed to install the “textdata” package and read it in R.
install.packages("textdata")
The downloaded binary packages are in
/var/folders/55/wts59gf53ygdkrq0kb6bqpg80000gn/T//RtmpneJr9L/downloaded_packages
library(textdata)Using the function of “get_sentiments” required the package “tidytext”. So I loaded it in R. Due to the final result used words “pass”, “fall”, and “withdrawn”, I used the technique sentiment to get the “positivity” of words in the tweets. Sentiment helps me to analysis and evaluate words for their emotional association. Also, I used “tokens” to represent the text data into a numeric format.
library(tidytext)
get_sentiments("nrc")# A tibble: 13,872 × 2
word sentiment
<chr> <chr>
1 abacus trust
2 abandon fear
3 abandon negative
4 abandon sadness
5 abandoned anger
6 abandoned fear
7 abandoned negative
8 abandoned sadness
9 abandonment anger
10 abandonment fear
# ℹ 13,862 more rows
tweets<-
studentInfo %>%
select(final_result, gender) %>%
mutate('final-result'=as.character(final_result))tokens <-
tweets %>%
unnest_tokens(output = word, input = 'final_result')
tokens# A tibble: 32,593 × 3
gender `final-result` word
<chr> <chr> <chr>
1 M Pass pass
2 F Pass pass
3 F Withdrawn withdrawn
4 F Pass pass
5 F Pass pass
6 M Pass pass
7 M Pass pass
8 F Pass pass
9 F Pass pass
10 M Pass pass
# ℹ 32,583 more rows
tokens |>
count(word, sort = TRUE)# A tibble: 4 × 2
word n
<chr> <int>
1 pass 12361
2 withdrawn 10156
3 fail 7052
4 distinction 3024
tokens |>
count(word, sort = TRUE) %>%
mutate(percent = n/sum(n)*100)# A tibble: 4 × 3
word n percent
<chr> <int> <dbl>
1 pass 12361 37.9
2 withdrawn 10156 31.2
3 fail 7052 21.6
4 distinction 3024 9.28
I used nrc_pos to create a new data set which contains the NRC words that have the positive sentiment. Then, I used count() to total up the appearances of each positive word.
nrc_pos <-
get_sentiments("nrc") %>%
filter(sentiment == "positive")
pos_tokens_count <-
tokens %>%
inner_join(nrc_pos, by = "word") %>%
count(word, sort = TRUE)
pos_tokens_count# A tibble: 1 × 2
word n
<chr> <int>
1 distinction 3024
library(ggplot2)
ggplot(student_info)+
geom_histogram(aes(x=studied_credits), bins=60)ggplot(studentAssessment)+
geom_histogram(aes(x=score), bins=10)Warning: Removed 173 rows containing non-finite values (`stat_bin()`).
ggplot(studentAssessment)+
geom_bar(aes(x=score), stat = "count")Warning: Removed 173 rows containing non-finite values (`stat_count()`).
library(ggplot2)
ggplot(studentInfo)+
geom_point(aes(x=final_result, y=studied_credits, color="fill"))Communication
Your data product should demonstrate your ability to clearly and effectively communicate the most important and most useful findings. Specifically, your data product should:
In this data analysis, I tried to figure out the relationship between students’ final results and their studied credits. However, from what I have here, the final results and studied credits influnced each other, but not always. Some students’ final results have some relationship with studied credits. For example, in the “student_info”, student earned 180 credits, but still failed in the course.
By arranged different variables and information, it is easy to read and find the relationship between each other. I still need more practice to manage this data set in a better way for my target audience or myself to understand the relationships. The imd_band looks like the percentages, but I’m not sure what it aims to. The highest_education could be another study item, I could also study the relationship between students’ highest_education and final_results.
Personally, I think this data set doesn’t contain enough numerical data for further analyze. The relationships between these variables are not obvious to see. And talking about some potential ethical/mural, I think the information of highest_education can be considered. But if the researchers received consent from their participants during the data collection stage, it could not be a big issue for this data set.