R/get_unique_instructors.R

Defines functions get_unique_instructors

Documented in get_unique_instructors

#' Get Unique Instructor Names
#'
#' Extracts a sorted vector of unique, non-empty instructor names from a schedule data frame.
#'
#' @param schedule_df A data frame containing an `INSTRUCTOR` column.
#'
#' @return A character vector of instructor names, sorted alphabetically.
#'
#' @examples
#' get_unique_instructors(schedule)
#'
#' @import dplyr
#' @export
get_unique_instructors <- function(schedule_df) {
  schedule_df %>%
    filter(!is.na(INSTRUCTOR), INSTRUCTOR != "") %>%
    distinct(INSTRUCTOR) %>%
    arrange(INSTRUCTOR) %>%
    pull(INSTRUCTOR)
}

Try the catool package in your browser

Any scripts or data that you put into this service are public.

catool documentation built on June 11, 2025, 5:09 p.m.