By Jason Bryer
This post describes a framework for using Shiny for conducting, grading, and providing feedback for assessments. This framework supports any multiple choice format including multiple choice tests or Likert type surveys. A demo is available at jbryer.shinyapps.io/ShinyAssessmentTest or can be run locally as a Github Gist:
runGist('a6fb5a3b1d5fd56cff64')
Key features of this framework include:
- Assessments take over the entire user interface for a distraction free assessment.
- Creating an assessment requires:
- A vector of item stems.
- A data frame with item choices.
- A function that will process the results.
- Button or link to start the assessment.
Example
Let’s walk through the statistics assessment example. The first step is to define the multiple choice items, here defined in a CSV file.
> math.items names(math.items)
[1] "Item" "Stem" "Answer" "A" "B" "C" "D" "E"
We will also define a function that will be called when the user completes the assessment. This function needs to have one parameter named results
. This parameter is a character vector of the user responses. The values are either NA
if there was no response, or the column name of the item.choices
defined below (here A through E). In this example, the results will be stored in a reactiveValues
object so that the UI will refresh with new results.
assmt.results
Next, we create an assessment by calling the ShinyAssessment
function.
test
The first three parameters, input
, output
, and session
are simply passed from shinyServer
. The other parameters you can set are:
name
The name of the assessment. This should be a name that follows R’s naming rules (i.e. does not start with a number, no spaces, etc).callback
The function called when the user submits the assessment. Used for saving the results.item.stems
A …read moreSource:: r-bloggers.com