filter_schedule {catool} | R Documentation |
Filter Course Schedule by College, Department, Program, Subject, and/or Instructor
Description
Applies one or more filters to a course schedule using pattern matching on instructor, subject, college, department, and program. All matching is case-insensitive and based on partial string matching.
Usage
filter_schedule(
schedule,
subject_pattern = NULL,
instructor_pattern = NULL,
college_pattern = NULL,
department_pattern = NULL,
program_pattern = NULL
)
Arguments
schedule |
A data frame containing the course schedule with required columns: |
subject_pattern |
Optional regex pattern to match subject codes (e.g., "CSCI", "^MATH"). |
instructor_pattern |
Optional regex pattern to match instructor names (e.g., "Smith", "^Jones"). |
college_pattern |
Optional regex pattern to match college names (e.g., "Science", "Engineering"). |
department_pattern |
Optional regex pattern to match department names (e.g., "Math", "Biology"). |
program_pattern |
Optional regex pattern to match program names (e.g., "Undergraduate", "MBA"). |
Value
A filtered data frame of matching courses.
Examples
schedule <- data.frame(
INSTRUCTOR = c("Lee", "Smith", "Jones", "Dawson", "Garcia"),
SUBJ = c("MATH", "NURS", "CSCI", "ENGL", "COMM"),
COLLEGE = c("Science", "Nursing", "Science", "Arts and Sciences", "Arts and Communication"),
DEPARTMENT = c("Math", "Nursing", "CS", "English", "Comm Studies"),
PROGRAM = c("BS", "BSN", "BS", "BA", "BA"),
stringsAsFactors = FALSE
)
filter_schedule(schedule, subject_pattern = "^MATH|^STAT")
filter_schedule(schedule, instructor_pattern = "smith")
filter_schedule(schedule, college_pattern = "Science")
filter_schedule(schedule, department_pattern = "Comm")
filter_schedule(schedule, program_pattern = "^BA$")