Parses XML data containing Stanford University course information into a structured data frame. The function processes detailed course data including basic course information, section details, schedules, and instructor information.
Value
A tibble containing course information with columns:
objectID
: Character. Unique course identifieryear
: Character. Academic yearsubject
: Character. Subject codecode
: Character. Course numbertitle
: Character. Course titledescription
: Character. Course descriptionunits_min
: Numeric. Minimum unitsunits_max
: Numeric. Maximum unitsAdditional columns for section, schedule, and instructor information when available
department
: Character. Department code
NULL
if no courses are found (with a warning)
Details
The function processes course data in several stages:
Locates all course nodes in the XML using XPath
For each course:
Extracts basic course information (ID, title, units, etc.)
Extracts section data including schedules and instructors
Joins section data with basic course information
Adds department code to all courses
Course sections may include:
Term information
Class components (e.g., lecture, discussion)
Schedule details (days, times, locations)
Instructor information
Enrollment data
See also
extract_basic_course_info()
for basic course data extractionextract_section_data()
for section and schedule processingfetch_department_courses()
for the public interface to this functionality
Examples
if (FALSE) { # \dontrun{
xml_data <- xml2::read_xml("cs_courses.xml")
cs_courses <- process_courses_xml(xml_data, "CS")
} # }