knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(retention.helpers) library(tidyverse)
Enrolments come in two levels at Charles Sturt University; course and subject. Course enrolments refer to the students' enrolment in a particular program of study, such as a Bachelor of Nursing. These are stored in the student_course
table. Subject level enrolments are stored in the enrolments
table, and correspond to the enrolment records for units of study in a particular session. These should match to the academic
table that stores the grades for each subject taken (if the student remained past census date).
The enrolments
tables also includes other pseudo-subjects, that are place holders for a Leave of Absence. These 'subjects' have the code XLV0000 and should not be treated like a normal subject. Subjects beginning with the code SSS... might also be needed to be treated differently, as they are free subjects and exhibit very different behaviour from students.
For this example, we set up a toy version of the student_course
and enrolments
tables. We rename them to match the names used in the (private) data.csu.retention
package.
student_course <- retention.helpers::toy_student_course enrolments <- retention.helpers::toy_enrolments glimpse(student_course) glimpse(enrolments)
We might want to look at the active enrolments in a particular session.
# gets all enrolments, and counts by student enrolments |> filter(session == 202230) |> count(id, sort = T) |> rename(n_subjects = n) # gets only those who remained in the subject, then counts by student enrolments |> filter(session == 202230, is.na(withdraw_date) # exluding those that have withdrawn ) |> count(id, sort = T) |> rename(n_subjects = n)
We might also be interested in what course these students are in. The toy data is primarily for the Bachelor of Nursing, however joining directly to the student_course table can produce errors if a student has been in multiple courses.
enrolments |> filter(session == 202230) |> distinct(id, session) |> inner_join( student_course |> select(id, course, course_code, admit_session, last_registered_session))
We need to select the most appropriate course, based on the admit_session
(when the student entered the course - however be warned this is sometimes later than their first subjects in the course!), and their last_registered_session
. Then it might be necessary to ignore the course_code
field as there can be multiple course codes for a single course.
students_in_202230 <- enrolments |> filter(session == 202230) |> distinct(id, session) |> inner_join( student_course |> select(id, course, course_code, admit_session, last_registered_session)) |> group_by(id, session) |> filter( # exclude any courses if already completed last_registered_session >= session | is.na(last_registered_session), # exclude if they entered the course after the session of interest admit_session <= session ) |> distinct(id, session, course) |> ungroup() students_in_202230
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.