Package 'RGIFT'

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

Help Index


Some functions to create questionnaires in the GIFT format.

Description

Functions to add comments, category and names to questions in GIFT format.

Usage

GIFTcomment(txt)
GIFTcategory(catname)
GIFTQName(qname)

Arguments

txt

Text for the comment.

catname

Category name.

qname

Question name.

Details

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.

Value

No value is returned but some text in printed.

Author(s)

Virgilio Gómez-Rubio <[email protected]>

See Also

https://docs.moodle.org/21/en/GIFT_format

Examples

GIFTcomment("Some examples")
GIFTcategory("Example")
GIFTQName("Question Name")

Description in GIFT format

Description

This function prints a Description text in GIFT format.

Usage

GIFTD(qtxt)

Arguments

qtxt

Text of the description.

Details

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.

Value

No value is returned but some text in printed.

Examples

#Description 1
GIFTD("R is a language for data analysis.")

Essay in GIFT format

Description

This function prints an Essay in GIFT format.

Usage

GIFTE(qtxt)

Arguments

qtxt

Text of the question.

Details

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.

Value

No value is returned but some text in printed.

Examples

#Question 1
GIFTE("Write a few words about the R programming language.")

Matching Question in GIFT format

Description

This function prints a Matching Question in GIFT format.

Usage

GIFTM(qtxt, group1, group2)

Arguments

qtxt

Text of the question.

group1

First group of words to match.

group2

Second group of words to match.

Details

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.

Value

No value is returned but some text in printed.

Examples

#Question 1
GIFTM("Match the following operations to their respective R commands:",
   c("mean", "variance", "standard deviation"), c("mean()", "var()", "sd()"))

Multiple Choice Question in GIFT format

Description

This function prints a Multiple Choice Question in GIFT format.

Usage

GIFTMC(qtxt, anstxt, rightans=1, wright=NULL, wwrong=NULL)

Arguments

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.

Details

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!).

Value

No value is returned but some text in printed.

Examples

#Question 1
GIFTMC("What's the mean of 1, 2, and 3?", c("1", "2", "3"), rightans=2,
   wwrong="-33.333")

Missing Word Question in GIFT format

Description

This function prints a Missing Word Question in GIFT format.

Usage

GIFTMW(qtxt1, qtxt2, anstxt, rightans)

Arguments

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.

Details

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.

Value

No value is returned but some text in printed.

Examples

#Question 1
GIFTMW("With the command ", " we can compute the mean of a vector of values",
   c("mean()", "sd()", "var()"), rightans=1)

Numeric Question in GIFT format

Description

This function prints a Numeric Question in GIFT format.

Usage

GIFTNQ(qtxt, ans, err=0)

Arguments

qtxt

Text of the question.

ans

Numeric answer.

err

Error allowed.

Details

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].

Value

No value is returned but some text in printed.

Examples

#Question 1
GIFTNQ("What's the mean of vector c(.4, .4, .5, .3)",
   as.character(mean(c(.4, .4, .5, .3))), .01)

Short Answer Question in GIFT format

Description

This function prints a Short Answer Question in GIFT format.

Usage

GIFTSA(qtxt, anstxt, wright="100")

Arguments

qtxt

Text of the question.

anstxt

Vector of short answers.

wright

Vector of weights for the right questions.

Details

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).

Value

No value is returned but some text in printed.

Examples

#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"))

True-False Question in GIFT format

Description

This function prints a True-False Question in GIFT format.

Usage

GIFTTF(qtxt, ans)

Arguments

qtxt

Text of the question.

ans

Either TRUE or FALSE depending on wether the question is true or false.

Details

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.

Value

No value is returned but some text in printed.

Examples

#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)