rank_students: Ranks students by their grade for a course or the program.

Description Usage Arguments Value Examples

View source: R/frgtracker.R

Description

Calculate the average grade for a specified number of students and ranks them for a specific course or for the whole program completed thus far.

Usage

1
rank_students(df, courseid = "all", n = 4, ascending = FALSE)

Arguments

df

A dataframe containing the final grades for each student per course.

courseid

A string representing the course ID for which the ranking should be calculated for. Defaults to "all" for all courses completed thus far.

n

An integer value that represents the number of students for which the ranking is required for. Defaults to 3.

ascending

A logical value indicating whether the top or bottom ranking of students is required. Defaults to FALSE.

Value

A dataframe containing the rank of the students for the course or for all the program completed thus far.

Examples

1
2
3
4
5
6
7
8
df <- data.frame(
  course_id = c(rep("511", 4)),
  student_id = c("tom", "tiff", "mike", "joel"),
  grade = c(90, 80, 70, 67)
)

rank_students(df = df)
rank_students(df = df, courseid = "511", n = 3, ascending = TRUE)

UBC-MDS/rgtracker documentation built on March 30, 2021, 12:03 p.m.