README.md

Description

rcanvas is a bouquet of functions to query your institution’s instance of the Canvas LMS.

Installation

rcanvas is not on CRAN, but can be installed via:

devtools::install_github("daranzolin/rcanvas")
library(rcanvas)

Setup

Some prep work is required before use. You must first safely stash your Canvas API token into your operating system’s keyring. This only needs to be done once.

To obtain the Canvas API token follow this trail in Canvas:

Canvas -> Account -> Settings -> Approved Integrations -> Add new token

You then need to run the following once in the R console:

set_canvas_token("YOUR_TOKEN_HERE")

Do not save your token or the code above in an .R file because it could compromise the security of your token.

Each time you run load the rcanvas library you need to set your domain like this:

set_canvas_domain("https://canvas.yourdomain.edu")

Functions

The following functions are implemented:

Usage

### Get all courses:
get_course_list()
get_course_list(include = c("teachers", "total_students"))

### Get course analytics data:
get_course_analytics_data(course_id = 20, type = "activity")

### Get course items:
get_course_items(course_id = 20, item = "users", include = "email")

### Get user items
get_user_items(user_id = 365, item = "details")
get_user_items(365, "missing_submissions")

### Get a course gradebook
get_course_gradebook(course_id = 20)

### Get submissions
get_submissions(course_id = 27, type = "assignments", type_id = 2248)
get_submissions(27, "quizzes", 168)

### Comment and grade submnissions
comment_submission(course_id = 27, assignment_id = 2248, 
                   user_id = 4227, comm = "Test comment!")
grade_submission(course_id = 27, assignment_id = 2248, 
                   user_id = 4227, grade = 95)

### Get announcements and discussions
get_announcements(course_id = 27) 
get_announcements(course_id = 27, start_date = "2017-02-01") 
get_discussions_context(4371405, object_type = "courses")

Future Work



daranzolin/rcanvas documentation built on May 18, 2024, 2:33 p.m.