View source: R/question_category.R
define_extended_question | R Documentation |
This function allows users to define an extended question, including metadata, feedback and optional image data.
define_extended_question(
qc,
category,
type,
fraction,
id,
name,
author,
fb_general,
fb_correct,
fb_partially,
fb_incorrect,
question,
image,
image_alt,
answer,
a_1,
a_2,
a_3,
a_4,
a_5,
a_6,
a_7,
fb_answer,
fb_a_1,
fb_a_2,
fb_a_3,
fb_a_4,
fb_a_5,
fb_a_6,
fb_a_7,
tag_1,
tag_2,
tag_3,
tag_4,
tag_5,
tag_6,
tag_7,
tag_8,
tag_9
)
## S3 method for class 'question_category'
define_extended_question(
qc,
category = "",
type = "",
fraction = 0,
id = "",
name = "",
author = "",
fb_general = "",
fb_correct = "",
fb_partially = "",
fb_incorrect = "",
question = "",
image = "",
image_alt = "",
answer = "",
a_1 = "",
a_2 = "",
a_3 = "",
a_4 = "",
a_5 = "",
a_6 = "",
a_7 = "",
fb_answer = "",
fb_a_1 = "",
fb_a_2 = "",
fb_a_3 = "",
fb_a_4 = "",
fb_a_5 = "",
fb_a_6 = "",
fb_a_7 = "",
tag_1 = "",
tag_2 = "",
tag_3 = "",
tag_4 = "",
tag_5 = "",
tag_6 = "",
tag_7 = "",
tag_8 = "",
tag_9 = ""
)
qc |
A question category object. It should have a |
category |
A character string specifying the category of the question. |
type |
A character string indicating the type of the question. |
fraction |
A number between 0 and 1. |
id |
A unique identifier for the question. |
name |
A character string representing the name of the question. |
author |
The name of the author of the question. |
fb_general |
General feedback for the question. |
fb_correct |
Feedback displayed when the correct answer is selected. |
fb_partially |
Feedback displayed for partially correct answers. |
fb_incorrect |
Feedback displayed for incorrect answers. |
question |
The text of the question. |
image |
Path to an image file associated with the question. |
image_alt |
Alternative text describing the image for accessibility. Required if an image is provided. |
answer |
The correct answer to the question. |
a_1 |
Additional possible answer. |
a_2 |
Additional possible answer. |
a_3 |
Additional possible answer. |
a_4 |
Additional possible answer. |
a_5 |
Additional possible answer. |
a_6 |
Additional possible answer. |
a_7 |
Additional possible answer. |
fb_answer |
Feedback for the correct answer. |
fb_a_1 |
Feedback for additional answer. |
fb_a_2 |
Feedback for additional answer. |
fb_a_3 |
Feedback for additional answer. |
fb_a_4 |
Feedback for additional answer. |
fb_a_5 |
Feedback for additional answer. |
fb_a_6 |
Feedback for additional answer. |
fb_a_7 |
Feedback for additional answer. |
tag_1 |
Tag to categorize the question. |
tag_2 |
Tag to categorize the question. |
tag_3 |
Tag to categorize the question. |
tag_4 |
Tag to categorize the question. |
tag_5 |
Tag to categorize the question. |
tag_6 |
Tag to categorize the question. |
tag_7 |
Tag to categorize the question. |
tag_8 |
Tag to categorize the question. |
tag_9 |
Tag to categorize the question. |
Parameter values that are not defined are taken from the category definition, if they are defined there.
The fraction
attribute is used in various question types to determine how a
specific answer impacts the question's score. Specifically, for incorrect answers
in the multichoice
and truefalse
types, the value calculated by dividing
fraction
by the number of incorrect answers available is considered as the
amount deducted in case of an incorrect response.
In the example provided, we have intentionally used the same structure as in
the define_question()
function to demonstrate that any parameters not needed
do not need to be explicitly defined.
Returns the updated question category object.
Other question definition functions:
define_question()
,
define_questions_from_csv()
,
define_questions_from_data_frame()
,
define_questions_from_excel()
,
generate_xml()
,
generate_xml_file()
,
question_category()
qc <- question_category(category = 'Initial test') |>
define_extended_question(
question = 'What are the basic arithmetic operations?',
answer = 'Addition, subtraction, multiplication and division.',
a_1 = 'Addition and subtraction.',
a_2 = 'Addition, subtraction, multiplication, division and square root.'
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.