GIFTr (version 0.1.0)

short_ans: Generate 'GIFT' Short Answer From Spreadsheet

Description

Create 'GIFT' file with short answer questions from a spreadsheet to be exported to LMS.

Usage

short_ans(data, questions, answers, categories, question_names = NULL,
  output, verbose = TRUE)

Arguments

data

dataframe or tibble of short answer questions data

questions

name(string) or index(integer) of the questions column

answers

a vector of names(strings) or indices of answers column(s)

categories

name(string) or index(integer) of categories column if available, Default: NULL

question_names

name(string) or index(integer) of the questions names column. If NULL, it will be the first 40 letters of the question title, Default: NULL

output

string of .txt file name and path where the questions will be exported to.

verbose

If TRUE, the functions will print to the console the statistics of writing the output, Default: TRUE

Value

None

Short Answer Questions Formatting

Short answer question answers can be in single column or multiple columns. If an answer has not credit it will be given 100% credit automatically. For example if the answer is 'statistics', it will be equivalent to '%100%statistics'. While '%80%Data Science' answer will take 80% of the credit For further illustration, check GIFTrData.

Formatting Your Data

A guideline for creating you questions data can be found below. Check the data GIFTrData and GIFTrData_2 as example for formatted questions.

Markdown, HTML Support and LATEX support

'MOODLE' itself supports basic markdown and HTML for questions formatting. So when formatting your data you can use HTML tags like <sub> and <sup>. Also you can use markdown **bold** or __bold__ and *italic* or _italic_ ...etc. However it is better a better practice to avoid using asterisk to avoid confusion with MCQ format. For more about the supported markdown see 'MOODLE' documentation.

LATEX Support

'MOODLE' also supports inline and block LATEX equations through mathjax, however you have to be careful with the special characters like curly brackets // and equal sign = , so you have to use back slash before those to ensure you can import correctly. Note that if you see thee data in console, you will find it with 2 backslash \, however that's the escaping of the backslash in R and you write with with single slash normally. Check GIFTrData GIFTrData[11,3]for an example. For further details on LATEX, check 'MOODLE' docs.

Answer Feedback

You can easily choose to enter a feedback by using #sign after the answer you want to specify a feedback on. Check GIFTrData for examples.

Data columns

The data passed would differ slightly according to question type, however generally you need to have:
  1. a column contains question. This cannot contain empty values

  2. answer(s) column(s). This may be multiple columns if you have multiple answers. If you mix single and multiple answer it is better to write the single answer in the first column. If you have only single answer MCQ and NO multiple answer MCQ, you can set the answers without asterisk in the first column of the answers columns. More details in the vignette and below.

  3. a column specifying the type of question. The current supported questions are multiple choices, numerical entry, true or false and short answer questions. The should be named 'mcq' , 'num_q' , 'tf_q' and 'short_ans' respectively.

  4. a column specifying categories and subcategories in the 'MOODLE' categories are important when you are preparing a quiz as you may want to specify certain proportions of inclusions. Categories and subcategories are spaced by forward slash like Categ1/subcateg1/subsubcateg1 ...etc.

  5. a column specifying question names. So you can easily enter a certain question names by like certain ID or keyword to make the questions easily on the system. however you don't need to worry about that as automatically if not set, the first 40 letter are set a question name.

Details

short_ans function takes a dataframe with short answer questions and export a text file in 'MOODLE' GIFT format. The function automatically makes a short answer question either single or multiple with or without different credit weight according to your data format(check short answer questions formatting below). If you have additional column of question_type set to `short_ans` you can also use GIFTr function which wraps all question generating functions. See Vignette and GIFTrData for demos.

See Also

GIFTr

Examples

Run this code
# NOT RUN {
data(GIFTrData)
#data with short answer question type
shortans_data <- GIFTrData[which(GIFTrData$question_type == "short_ans"),]

short_ans(data = shortans_data, questions = 3,
 answers = c(4:8), categories = 1,
 question_names = 2, output = file.path(tempdir(), "shortq.txt"))
 #write file "shortq.txt" in tempdir()

# }

Run the code above in your browser using DataCamp Workspace