Skip to content

Creating assignments

Richard Morey edited this page Jul 19, 2021 · 16 revisions

Creating assignments

This content is relevant to flexTeaching version 0.2.

Assignment structure

Each assignment is a located in its own subfolder of the inst/assignments/ folder of the package. If the folder is named beginning with an underscore, it is not used. This enables disabling whole assignments simply by renaming the folders.

In addition, there is an inst/assignments/_common folder that contains content common to all assignments. This is useful for utility functions, etc.

There are two necessary files in the folder for every assignment: _assignment.yml, which contains the settings for the assignment, and index.Rmd, which contains the source Rmarkdown to be compiled and displayed.

Also necessary is some R source file that defines the function to run to compile the html from the Rmarkdown. This will often be a boilerplate function defined in inst/assignments/_common/R. Customizing this function is possible, but not necessary.

Assignment settings

The settings for each assignment are contained in a file called _assignment.yml.

Setting Optional? Content Description
title No String A title for the assignment to use in the menu
shortname No String A shortname to use for linking directly to the assignment
author Yes String Author of the assignment
date Yes String Date the assignment was last edited/created
version Yes String Version of the assignment
note Yes String An optional note describing the assignment, etc
category Yes String A category/group name for the menu
sortkey Yes String The key to use in sorting assignment within the menu
hide_before Yes String parsable by base::strptime using the default format "%Y-%m-%d %H:%M:%S" Hide the assignment before this date. It will not appear in the menu, but it will still be accessible (unless restricted)
restrict_before Yes String parsable by base::strptime using the default format "%Y-%m-%d %H:%M:%S" Restrict (make inaccessible) the assignment before this date. It will still appear in the menu (unless hidden)
seed-salt Yes String Salt to use for creating the assignment seed from the master seed
data-salt Yes String Additional salt to use when compiling the assignment
source Yes Array of file names R files to source() into the environment
init No String, name of function The function to run before compiling the assignment (typically producing data sets, results, etc)
html-gen No String, name of function The function to compile the html from the markdown
buttons Yes String, name of list A list of lists, each element of which contains details of buttons to create for the assignment

Assignment markdown

The main source markdown is contained in a file called index.Rmd. This should be a plain Rmarkdown file with no YAML header.

Clone this wiki locally