Calculate students' course grades to rank courses in ascending/descending order by a specified method.

rank_courses(
  courses,
  grades,
  method = c("mean", "1st-quantile", "median", "3rd-quantile"),
  descending = TRUE
)

Arguments

courses

A dataframe containing component weights for each course

grades

A dataframe containing grades for students

method

one of "method", "median", "lst-quantile", "3rd-quantile", defining the method for calculating the course rankings.

descending

A logical value to decide if the rank should be in descending or ascending order. Default to True

Value

A dataframe containing the rank for specified courses

Examples

grades <- data.frame( course_id = c(511, 511, 511, 511, 522, 522, 522, 522), student_id = c("tom", "tiff", "mike", "joel", "tom", "tiff", "mike", "joel"), lab1 = c(100, 87.6, 84.4, 100, 0, 0, 0, 0), lab2 = c(100, 100, 79.6, 100, 0, 0, 0, 0), lab3 = c(79.2, 81.2, 75.2, 99.6, 0, 0, 0, 0), lab4 = c(83.6, 89.2, 98.8, 71.2, 0, 0, 0, 0), quiz1 = c(75.6, 100, 84.8, 96.8, 0, 0, 0, 0), quiz2 = c(75.6, 73.2, 100, 79.2, 0, 0, 0, 0), milestone1 = c(0, 0, 0, 0, 100, 100, 92, 98.4), milestone2 = c(0, 0, 0, 0, 97.6, 77.2, 75.6, 85.6), milestone3 = c(0, 0, 0, 0, 80, 76.8, 97.6, 96.8), milestone4 = c(0, 0, 0, 0, 100, 100, 84.4, 100), feedback = c(0, 0, 0, 0, 100, 85.6, 98.8, 82.4) ) courses <- data.frame( course_id = c(511, 522), lab1 = c(0.15, 0), lab2 = c(0.15, 0), lab3 = c(0.15, 0), lab4 = c(0.15, 0), quiz1 = c(0.2, 0), quiz2 = c(0.2, 0), milestone1 = c(0, 0.1), milestone2 = c(0, 0.2), milestone3 = c(0, 0.2), milestone4 = c(0, 0.3), feedback = c(0, 0.2) ) rank_courses(courses, grades, "mean")
#> course_id grade #> 2 522 91.29 #> 1 511 87.87
rank_courses(courses, grades, "median", descending=FALSE)
#> course_id grade #> 1 511 88 #> 2 522 90.86