student_course <- data.frame(
student_id = 1:5,
course_code = c(1, 2, 1, 3, 4),
course_duration = c(12, 12, 12, 12, 12),
course_topic = c("Song", "Dance", "Song", "Painting", "Pottery")
)
# Check that each `course_code` corresponds to exactly one combination of
# `course_duration` and `course_topic`
expect_depends(
c(course_duration, course_topic),
on = course_code,
data = student_course
)
Run the code above in your browser using DataLab