For each student, the mark for each component will be multiplied with its associated weight, and summed up altogether.
calculate_final_grade(courses, grades, course_ids)
courses | A dataframe containing component weights for each course |
---|---|
grades | A dataframe containing grades for students |
course_ids | A vector of strings representing the course IDs for which final grades should be calculated. |
A dataframe containing final grades for all students in a course.
grades <- data.frame( course_id = c("511"), student_id = c("tom"), lab1 = c(100), lab2 = c(80) ) courses <- data.frame( course_id = c("511"), lab1 = c(0.45), lab2 = c(0.55) ) calculate_final_grade(courses, grades, course_ids = c("511"))#> course_id student_id grade #> 1 511 tom 89