Title: | Create Quizzes in GIFT Format |
---|---|
Description: | Implementation of some functions to create quizzes in the GIFT format. This format is used by several Virtual Learning Environments such as Moodle. |
Authors: | María José Haro-Delicado, Virgilio Gómez-Rubio and Francisco Parreńo-Torres |
Maintainer: | Virgilio Gómez-Rubio <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1-7 |
Built: | 2024-11-01 11:14:38 UTC |
Source: | https://github.com/becarioprecario/rgift |
Functions to add comments, category and names to questions in GIFT format.
GIFTcomment(txt) GIFTcategory(catname) GIFTQName(qname)
GIFTcomment(txt) GIFTcategory(catname) GIFTQName(qname)
txt |
Text for the comment. |
catname |
Category name. |
qname |
Question name. |
These functions use the cat()
function to format the comment, category
or question name in GIFT format and print them. Use of the sink()
function is adviced to send the ouput to a text file.
No value is returned but some text in printed.
Virgilio Gómez-Rubio <[email protected]>
https://docs.moodle.org/21/en/GIFT_format
GIFTcomment("Some examples") GIFTcategory("Example") GIFTQName("Question Name")
GIFTcomment("Some examples") GIFTcategory("Example") GIFTQName("Question Name")
This function prints a Description text in GIFT format.
GIFTD(qtxt)
GIFTD(qtxt)
qtxt |
Text of the description. |
This function uses the cat()
function to print a Description in the GIFT
format. No question is made but a text is printed. Use of the sink()
function is adviced to send the ouput to a text file.
No value is returned but some text in printed.
#Description 1 GIFTD("R is a language for data analysis.")
#Description 1 GIFTD("R is a language for data analysis.")
This function prints an Essay in GIFT format.
GIFTE(qtxt)
GIFTE(qtxt)
qtxt |
Text of the question. |
This function uses the cat()
function to print an Essay in the GIFT
format. In this question, the user is asked to write down an essay in a text
box. Use of the sink()
function is adviced to send the ouput to a text
file.
No value is returned but some text in printed.
#Question 1 GIFTE("Write a few words about the R programming language.")
#Question 1 GIFTE("Write a few words about the R programming language.")
This function prints a Matching Question in GIFT format.
GIFTM(qtxt, group1, group2)
GIFTM(qtxt, group1, group2)
qtxt |
Text of the question. |
group1 |
First group of words to match. |
group2 |
Second group of words to match. |
These functions use the cat()
function to print a Matching
Question
in the GIFT format. In this questions, the user is given two list
of words to be matched. Use of the sink()
function is adviced to send the ouput to a text
file.
No value is returned but some text in printed.
#Question 1 GIFTM("Match the following operations to their respective R commands:", c("mean", "variance", "standard deviation"), c("mean()", "var()", "sd()"))
#Question 1 GIFTM("Match the following operations to their respective R commands:", c("mean", "variance", "standard deviation"), c("mean()", "var()", "sd()"))
This function prints a Multiple Choice Question in GIFT format.
GIFTMC(qtxt, anstxt, rightans=1, wright=NULL, wwrong=NULL)
GIFTMC(qtxt, anstxt, rightans=1, wright=NULL, wwrong=NULL)
qtxt |
Text of the question. |
anstxt |
Vector of short answers. |
rightans |
Position of right answers in anstxt. |
wright |
Vector of weights for the right answer. |
wwrong |
Vector of weights for the wrong answers. |
These functions use the cat()
function to print a Multiple
Choice Question
in the GIFT format. In this questions, the user is asked to select one or
more answers. Use of the sink()
function is adviced to send the ouput to a text
file.
If there are more than one right answer the length of anstxt and wright must be the same. In addition, it one of the elements in wright is "100" then only one answer can be chosen. Otherwise, the user can select several right answers (in this case remember to use negative weights for the wrong answers!).
No value is returned but some text in printed.
#Question 1 GIFTMC("What's the mean of 1, 2, and 3?", c("1", "2", "3"), rightans=2, wwrong="-33.333")
#Question 1 GIFTMC("What's the mean of 1, 2, and 3?", c("1", "2", "3"), rightans=2, wwrong="-33.333")
This function prints a Missing Word Question in GIFT format.
GIFTMW(qtxt1, qtxt2, anstxt, rightans)
GIFTMW(qtxt1, qtxt2, anstxt, rightans)
qtxt1 |
First part of the text of the question. |
qtxt2 |
Second part of the text of the question. |
anstxt |
Vector of short answers. |
rightans |
Position of the right answer in anstxt. |
These functions use the cat()
function to print a Missing Word
Question
in the GIFT format. In this question, the user is asked to select a missing
word which should go between 'qtxt1' and 'qtxt2'.
Use of the sink()
function is adviced to send the ouput to a text
file.
No value is returned but some text in printed.
#Question 1 GIFTMW("With the command ", " we can compute the mean of a vector of values", c("mean()", "sd()", "var()"), rightans=1)
#Question 1 GIFTMW("With the command ", " we can compute the mean of a vector of values", c("mean()", "sd()", "var()"), rightans=1)
This function prints a Numeric Question in GIFT format.
GIFTNQ(qtxt, ans, err=0)
GIFTNQ(qtxt, ans, err=0)
qtxt |
Text of the question. |
ans |
Numeric answer. |
err |
Error allowed. |
These functions use the cat()
function to print a Numerical
Question
in the GIFT format. In this question, the user is asked to write down
a number. Use of the sink()
function is adviced to send the ouput to a text
file.
The range of answers allows is 'ans' plus/minus 'err' unless 'ans' is of length 2. In that case, the range of valid answers is ans[1] to ans[2].
No value is returned but some text in printed.
#Question 1 GIFTNQ("What's the mean of vector c(.4, .4, .5, .3)", as.character(mean(c(.4, .4, .5, .3))), .01)
#Question 1 GIFTNQ("What's the mean of vector c(.4, .4, .5, .3)", as.character(mean(c(.4, .4, .5, .3))), .01)
This function prints a Short Answer Question in GIFT format.
GIFTSA(qtxt, anstxt, wright="100")
GIFTSA(qtxt, anstxt, wright="100")
qtxt |
Text of the question. |
anstxt |
Vector of short answers. |
wright |
Vector of weights for the right questions. |
These functions use the cat()
function to print a Short Answer Question
in the GIFT format. In this questions, the user is asked to write a short anwser
down. Use of the sink()
function is adviced to send the ouput to a text
file.
If there are more than one right answer the length of anstxt and wright must be the same and one of the weights should be equal to "100" (i.e., completely right answer).
No value is returned but some text in printed.
#Question 1 GIFTSA("The mean of 1, 2, and 3 is", c("Two", "2"), wright = c("100", "100")) #Question 2 GIFTSA("Compute the mean of 1, 2 and 3", c("mean(c(1,2,3))", "sum(c(1,2,3))/3", "sum(c(1,2,3))/length(c(1,2,3))", "(1+2+3)/3"), wright=c("100", "75", "75", "50"))
#Question 1 GIFTSA("The mean of 1, 2, and 3 is", c("Two", "2"), wright = c("100", "100")) #Question 2 GIFTSA("Compute the mean of 1, 2 and 3", c("mean(c(1,2,3))", "sum(c(1,2,3))/3", "sum(c(1,2,3))/length(c(1,2,3))", "(1+2+3)/3"), wright=c("100", "75", "75", "50"))
This function prints a True-False Question in GIFT format.
GIFTTF(qtxt, ans)
GIFTTF(qtxt, ans)
qtxt |
Text of the question. |
ans |
Either TRUE or FALSE depending on wether the question is true or false. |
These functions use the cat()
function to print a True-False
Question
in the GIFT format. In this question, the user is asked to select whether
the statement in the question is true or false.
Use of the sink()
function is adviced to send the ouput to a text
file.
No value is returned but some text in printed.
#Question 1 GIFTTF("The mean of 1, 2, and 3 is 3?", TRUE) #Question 2 GIFTTF("The command to compute the mean is sd()", FALSE)
#Question 1 GIFTTF("The mean of 1, 2, and 3 is 3?", TRUE) #Question 2 GIFTTF("The command to compute the mean is sd()", FALSE)