library(tidyverse)── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.2.1 ✔ readr 2.2.0
✔ forcats 1.0.1 ✔ stringr 1.6.0
✔ ggplot2 4.0.4 ✔ tibble 3.3.1
✔ lubridate 1.9.5 ✔ tidyr 1.3.2
✔ purrr 1.2.2
── 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
student_info <- read_csv("data/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.
glimpse(student_info)Rows: 32,593
Columns: 12
$ code_module <chr> "AAA", "AAA", "AAA", "AAA", "AAA", "AAA", "AAA", …
$ code_presentation <chr> "2013J", "2013J", "2013J", "2013J", "2013J", "201…
$ id_student <dbl> 11391, 28400, 30268, 31604, 32885, 38053, 45462, …
$ gender <chr> "M", "F", "F", "F", "F", "M", "M", "F", "F", "M",…
$ region <chr> "East Anglian Region", "Scotland", "North Western…
$ highest_education <chr> "HE Qualification", "HE Qualification", "A Level …
$ imd_band <chr> "90-100%", "20-30%", "30-40%", "50-60%", "50-60%"…
$ age_band <chr> "55<=", "35-55", "35-55", "35-55", "0-35", "35-55…
$ num_of_prev_attempts <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ studied_credits <dbl> 240, 60, 60, 60, 60, 60, 60, 120, 90, 60, 60, 60,…
$ disability <chr> "N", "N", "Y", "N", "N", "N", "N", "N", "N", "N",…
$ final_result <chr> "Pass", "Pass", "Withdrawn", "Pass", "Pass", "Pas…
course_counts <- student_info %>%
count(code_module, code_presentation, sort = TRUE)
course_counts# A tibble: 22 × 3
code_module code_presentation n
<chr> <chr> <int>
1 CCC 2014J 2498
2 FFF 2014J 2365
3 BBB 2014J 2292
4 FFF 2013J 2283
5 BBB 2013J 2237
6 DDD 2013J 1938
7 CCC 2014B 1936
8 DDD 2014J 1803
9 BBB 2013B 1767
10 FFF 2013B 1614
# ℹ 12 more rows