View source: R/filter_schedule.R
filter_schedule | R Documentation |
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.
filter_schedule(
schedule,
subject_pattern = NULL,
instructor_pattern = NULL,
college_pattern = NULL,
department_pattern = NULL,
program_pattern = NULL
)
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"). |
A filtered data frame of matching courses.
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$")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.