The goal of gradeR is to help grade bunches of R script assignment submissions. This package has two primary functions called calcGrades() and calcGradesForGradescope, and much of the testing functionality is taken from the testthat package.


You can install the released version of gradeR from CRAN with:


You can install the development version of gradeR with:

# install.packages("devtools")


This is a basic overview which shows you how to grade a bunch of assignment submissions. Make sure to change the paths to ones that actually exist on your machine. For more details on this example, see the vignette.

# load in the package

# this is the directory with all of the student submissions
submissionDir <- "../submissions/"

# get the grades
grades <- calcGrades(submission_dir = submissionDir, 
                     your_test_file = "~/your/path/assignment1_test_file.r")

The directory of the first argument will be walked recursively, and any file ending in a .R or .r will be sourced and tested using the tests in the assignment1_grading_file.r.

The file with the tests is specified in the second argument. This is a file you must create on your own. For more information on how to write testthat tests, see this.

It might be beneficial to recommend that your students:


Please see for more information on how you can contribute to this project!