Filter Course Schedule by Instructor (Regex-Friendly, Case-Insensitive)
Source:R/get_instructor_schedule.R
get_instructor_schedule.Rd
Returns a subset of the course schedule containing courses taught by the specified instructor. Matching is case-insensitive and supports regular expressions, allowing flexible partial or pattern-based matching. If no match is found, a warning is issued and an empty data frame is returned.
Arguments
- instructor_name
A character string (or regular expression) used to match against values in the
INSTRUCTOR
column.- schedule_df
A data frame containing course schedule data with an
INSTRUCTOR
column. Defaults toschedule
if not specified.
Value
A data frame of courses assigned to instructors matching the given pattern, sorted by descending enrollment.
Examples
get_instructor_schedule("smith", schedule_df = schedule) # partial match
#> P.of.T SUBJ NUMB SECT CRN TITLE NOTES HRS ENRLD
#> 1 1 CSCI 4999 1 49388 SPECIAL TOPICS IN CSCI/CSIS 3 12
#> MAXENRL TIMES DAYS LOCATION INSTRUCTOR
#> 1 15 11:00-12:15 T R 0219 COMPUTER TECHNOLOGY/MATHE Smith, Courtney
#> CAMPUS
#> 1 Main Campus
get_instructor_schedule("^Smith,", schedule_df = schedule) # regex: starts with Smith
#> P.of.T SUBJ NUMB SECT CRN TITLE NOTES HRS ENRLD
#> 1 1 CSCI 4999 1 49388 SPECIAL TOPICS IN CSCI/CSIS 3 12
#> MAXENRL TIMES DAYS LOCATION INSTRUCTOR
#> 1 15 11:00-12:15 T R 0219 COMPUTER TECHNOLOGY/MATHE Smith, Courtney
#> CAMPUS
#> 1 Main Campus
get_instructor_schedule("Robinson|Smith", schedule_df = schedule) # regex: matches either
#> P.of.T SUBJ NUMB SECT CRN TITLE NOTES HRS ENRLD
#> 1 1 CSCI 4999 1 49388 SPECIAL TOPICS IN CSCI/CSIS 3 12
#> MAXENRL TIMES DAYS LOCATION INSTRUCTOR
#> 1 15 11:00-12:15 T R 0219 COMPUTER TECHNOLOGY/MATHE Smith, Courtney
#> CAMPUS
#> 1 Main Campus