While neglecting my Python coursework this fall, I wrote an rstats package called rcanvas.
rcanvas is an R client for the Canvas LMS API. It makes getting course data from your institution’s Canvas LMS easy, and I’ve utilized it
in a variety of ways at work. And despite the Canvas Developer community’s tepid response,
I am optimistic about its future. Perhaps a quick demonstration will help.
In this post, I will show how to prepare progress updates with R. This post only addresses getting the necessary data from Canvas,
because Jenny Bryan already has a fantastic tutorial on sending the emails. Note: before reading on,
make sure your
CANVAS_API_TOKEN is an environment variable in your
First, we load the required packages:
Next, we’ll obtain the course ids for the courses to which we wish to send updates. At work I would chain a
filter() clause to
get_course_list() to specify the precise courses, but that would be unique to me.
courses is a
data.frame with a variety of course information. To get each student’s current grade and email, we’ll
have to make two separate calls to
get_course_items() within a custom function before iterating through a vector
of course ids.
student_data now contains all the necessary data: each student’s name, grade, email, and course name (or code). With
sprintf(), you can
construct a prose message that ties each of these elements in as stern or celebratory fashion as you wish.
rcanvas functionality is forthcoming.