| Title: | Create Tests According to QTI 2.1 Standard |
|---|---|
| Description: | Create tests and tasks compliant with the Question & Test Interoperability (QTI) information model version 2.1. Input sources are Rmd/md description files or S4-class objects. Output formats include standalone zip or xml files. Supports the generation of basic task types (single and multiple choice, order, pair association, matching tables, filling gaps and essay) and provides a comprehensive set of attributes for customizing tests. |
| Authors: | Andrey Shevandrin [aut, cre, cph] (ORCID: <https://orcid.org/0000-0003-0807-2546>), Petr Bondarenko [ctb] (ORCID: <https://orcid.org/0000-0002-5154-9664>), Ivonne Ojeda [ctb], Johannes Titz [aut, cph] (ORCID: <https://orcid.org/0000-0002-1102-5719>), Brian Mottershead [cph] (Author of QTIJS library), Stiftung für Innovation in der Hochschullehre [fnd] |
| Maintainer: | Andrey Shevandrin <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.3.1.9000 |
| Built: | 2026-10-20 15:27:16 UTC |
| Source: | https://github.com/shevandrin/rqti |
This method adds a user to a group on the Learning Management System (LMS). If no LMS connection object is provided, it attempts to guess the connection using default settings (e.g., environment variables). If the connection cannot be established, an error is thrown.
This method adds a user to a learning group in LMS Opal by group id and user id.
addGroupUser(object, group_id, user_id) ## S4 method for signature 'missing' addGroupUser(object, group_id, user_id) ## S4 method for signature 'Opal' addGroupUser(object, group_id, user_id)addGroupUser(object, group_id, user_id) ## S4 method for signature 'missing' addGroupUser(object, group_id, user_id) ## S4 method for signature 'Opal' addGroupUser(object, group_id, user_id)
object |
An S4 object of class Opal that represents a connection to the LMS. |
group_id |
A character vector of length one specifying the group ID. |
user_id |
A character vector of length one specifying the user ID. |
Status code of the HTTP request.
Status code 200 if the user was added successfully, or NULL when
OPAL rejects the request.
addGroupUser("442662912", "196610") addGroupUser("442662912", "196610")addGroupUser("442662912", "196610") addGroupUser("442662912", "196610")
Abstract class AssessmentItem is responsible for creating a root element
'assessmentItem' in XML task description according to QTI 2.1. This class is
not meant to be instantiated directly; instead, it serves as a base for
derived classes.
identifierA character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits.
titleA character representing the title of the XML file associated with the task. By default, it takes the value of the identifier.
contentA list of character content to form the text of the question, which can include HTML tags. For tasks of the Entry type, it must also contain at least one instance of Gap objects, such as TextGap, TextGapOpal, NumericGap, or InlineChoice.
promptAn optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "".
pointsA numeric value, optional, representing the number of points for the entire task. Default is 1, but pay attention:
For tasks of the Entry type, it is calculated as the sum of the gap points by default.
For tasks of the DirectedPair, the default is calculated as 0.5 points per pair.
For tasks of the MatchTable type, it can also be calculated as the sum of points for individual answers, when provided.
For tasks of the MultipleChoice type, points is numeric vector and
required. Each number in this vector determines the number of points that
will be awarded to a candidate if they select the corresponding answer. The
order of the scores must match the order of the choices. It is possible
to assign negative values to incorrect answers. All answers with a
positive score are considered correct.
feedbackA list containing feedback messages for candidates. Each element of the list should be an instance of either ModalFeedback, CorrectFeedback, or WrongFeedback class.
calculatorA character, optional, determining whether to show a calculator to the candidate. Possible values:
"simple"
"scientific"
filesA character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam.
metadataAn object of class QtiMetadata that holds metadata information about the task.
stylesheet_pathOptional character vector of local CSS file paths. Stylesheets are linked from the item and included in QTI exports. In Rmd YAML, relative paths are resolved against the Rmd file's directory.
cssOptional single character string of CSS text, linked after any
files in stylesheet_path. In Rmd YAML, use a literal block (css: |).
CSS assets referenced by url() or @import are not bundled automatically.
Create an AssessmentSection rqti-object as part of a test content
assessmentSection( assessment_item, identifier = generate_id(type = "section"), title = identifier, selection = NA_integer_, time_limit = NA_integer_, visible = TRUE, shuffle = FALSE, max_attempts = NA_integer_, allow_comment = TRUE )assessmentSection( assessment_item, identifier = generate_id(type = "section"), title = identifier, selection = NA_integer_, time_limit = NA_integer_, visible = TRUE, shuffle = FALSE, max_attempts = NA_integer_, allow_comment = TRUE )
assessment_item |
A list containing AssessmentSection and/or Assessment item objects, such as SingleChoice, MultipleChoice, Essay, Entry, Ordering, OneInRowTable, OneInColTable, MultipleChoiceTable, and DirectedPair. |
identifier |
A character value indicating the identifier of the test file. By default, it is generated as 'id_section_dddd', where dddd represents random digits. |
title |
A character value, optional, representing the file title. By
default, it takes the value of the |
selection |
An integer value, optional, defining how many children of
the section are delivered in the test. Default is |
time_limit |
An integer value, optional, controlling the amount of time in minutes a candidate is allowed for this part of the test. |
visible |
A boolean value, optional, indicating whether the title of
this section is shown in the hierarchy of the test structure. Default is
|
shuffle |
A boolean value, optional, responsible for randomizing the
order in which the assessment items and subsections are initially presented
to the candidate. Default is |
max_attempts |
An integer value, optional, enabling the maximum number of attempts allowed for a candidate to pass this section. |
allow_comment |
A boolean value, optional, enabling candidates to leave
comments on each question of the section. Default is |
An object of class AssessmentSection.
section(), test(), test4opal()
sc <- singleChoice(prompt = "Question", choices = c("A", "B", "C")) es <- essay(prompt = "Question") # Since ready-made S4 "AssessmentItem" objects are taken, in this example a #permanent section consisting of two tasks is created. s <- assessmentSection(list(sc, es), title = "Section with nonrandomized tasks")sc <- singleChoice(prompt = "Question", choices = c("A", "B", "C")) es <- essay(prompt = "Question") # Since ready-made S4 "AssessmentItem" objects are taken, in this example a #permanent section consisting of two tasks is created. s <- assessmentSection(list(sc, es), title = "Section with nonrandomized tasks")
Class AssessmentSection is responsible for forming a section in the test
XML specification according to QTI 2.1.
identifierA character representing the unique identifier of the assessment section. By default, it is generated as 'id_section_dddd', where dddd represents random digits.
titleA character representing the title of the section in the test. By default, it takes the value of the identifier.
time_limitA numeric value, optional, controlling the amount of time in minutes a candidate is allowed for this part of the test.
visibleA boolean value, optional. If TRUE, it shows this section in
the hierarchy of the test structure. Default is TRUE.
assessment_itemA list containing AssessmentSection and/or Assessment item objects, such as SingleChoice, MultipleChoice, Essay, Entry, Ordering, OneInRowTable, OneInColTable, MultipleChoiceTable, and DirectedPair.
shuffleA boolean value, optional, determining whether to randomize the
order in which the assessment items and subsections are initially presented
to the candidate. Default is FALSE.
selectionA numeric value, optional, defining how many children of the section are delivered in the test.
max_attemptsA numeric value, optional, enabling the maximum number of attempts a candidate is allowed to make in this section.
allow_commentA boolean value, optional, allowing the candidate to
leave comments on each question of the section. Default is
TRUE.
section(), test(), test4opal(), AssessmentTest,
AssessmentTestOpal.
sc1 <- new("SingleChoice", prompt = "Example task 1", title = "SC1", identifier = "q1", choices = c("a", "b", "c")) sc2 <- new("SingleChoice", prompt = "Example task 2", title = "SC2", identifier = "q2", choices = c("A", "B", "C")) sc3 <- new("SingleChoice", prompt = "Example task 3", title = "SC3", identifier = "q3", choices = c("aa", "bb", "cc")) exam_section <- new("AssessmentSection", identifier = "sec_id", title = "Section", time_limit = 20, visible = FALSE, assessment_item = list(sc1, sc2, sc3), shuffle = FALSE, selection = 1, max_attempts = 1, allow_comment = FALSE)sc1 <- new("SingleChoice", prompt = "Example task 1", title = "SC1", identifier = "q1", choices = c("a", "b", "c")) sc2 <- new("SingleChoice", prompt = "Example task 2", title = "SC2", identifier = "q2", choices = c("A", "B", "C")) sc3 <- new("SingleChoice", prompt = "Example task 3", title = "SC3", identifier = "q3", choices = c("aa", "bb", "cc")) exam_section <- new("AssessmentSection", identifier = "sec_id", title = "Section", time_limit = 20, visible = FALSE, assessment_item = list(sc1, sc2, sc3), shuffle = FALSE, selection = 1, max_attempts = 1, allow_comment = FALSE)
Create an AssessmentTest rqti-object.
assessmentTest( section, identifier = generate_id(type = "test"), title = identifier, time_limit = NULL, max_attempts = 1L, fallback_titles = "generic", academic_grading = NULL, grade_label = c(en = "Grade", de = "Note"), table_label = c(en = "Grade", de = "Note"), navigation_mode = "nonlinear", submission_mode = "individual", allow_comment = TRUE, rebuild_variables = TRUE, metadata = qtiMetadata(), stylesheet_path = NULL, points = NA_real_ )assessmentTest( section, identifier = generate_id(type = "test"), title = identifier, time_limit = NULL, max_attempts = 1L, fallback_titles = "generic", academic_grading = NULL, grade_label = c(en = "Grade", de = "Note"), table_label = c(en = "Grade", de = "Note"), navigation_mode = "nonlinear", submission_mode = "individual", allow_comment = TRUE, rebuild_variables = TRUE, metadata = qtiMetadata(), stylesheet_path = NULL, points = NA_real_ )
section |
A list containing AssessmentSection objects. |
identifier |
A character value indicating the identifier of the test file. By default, it is generated as 'id_test_dddd', where dddd represents random digits. |
title |
A character value, optional, representing the file title. By default, it takes the value of the identifier. |
time_limit |
An integer value, optional, controlling the time given to a
candidate for the test in minutes. Default is |
max_attempts |
An integer value, optional, indicating the maximum number of attempts allowed for the candidate. Default is 1. |
fallback_titles |
A character value, optional, controlling how titles are assigned when no explicit title is provided. Possible values are "filename" (use filenames as titles) and "generic" (use generic labels such as "Section 1", "Section 1.2", or "Task 1.2.1"). Default is "generic". |
academic_grading |
A named numeric vector that defines the grade table shown to the candidate as feedback at the end of the test. Each grade corresponds to the minimum percentage score required to achieve it.
A helper function The default is |
grade_label |
A character value, optional; a short message that shows with a grade in the final feedback; for multilingual use, it can be a named vector with two-letter ISO language codes as names (e.g., c(en="Grade", de="Note")); during test creation, it takes the value for the language of the operating system; c(en="Grade", de="Note")is default. |
table_label |
A character value, optional; a concise message to display as the column title of the grading table in the final feedback; for multilingual use, it can be a named vector with two-letter ISO language codes as names (e.g., c(en="Grade", de="Note")); during test creation, it takes the value for the language of the operating system; c(en="Grade", de="Note")is default. |
navigation_mode |
A character value, optional, determining the general paths that the candidate may have during the exam. Two mode options are possible:
|
submission_mode |
A character value, optional, determining when the candidate's responses are submitted for response processing. One of two mode options is possible:
|
allow_comment |
A boolean, optional, allowing the candidate to leave
comments on each question. Default is |
rebuild_variables |
A boolean, optional, enabling the recalculation of
variables and reshuffling the order of choices for each item-attempt.
Default is |
metadata |
An object of class QtiMetadata that holds metadata
information about the test. By default it creates QtiMetadata object. See
|
stylesheet_path |
A character value, optional, specifying the path to a
custom CSS stylesheet. If provided, the stylesheet is included at the
assessment test level and applied during rendering. When
|
points |
Do not use directly; the maximum number of points for the exam/test. It is calculated automatically as a sum of points of included tasks. |
An AssessmentTest object.
test(), test4opal(), section(), AssessmentTest,
AssessmentSection
sc <- sc <- singleChoice(prompt = "Question", choices = c("A", "B", "C")) es <- new("Essay", prompt = "Question") s <- section(c(sc, es), title = "Section with nonrandomized tasks") t <- assessmentTest(list(s), title = "Example of the Exam")sc <- sc <- singleChoice(prompt = "Question", choices = c("A", "B", "C")) es <- new("Essay", prompt = "Question") s <- section(c(sc, es), title = "Section with nonrandomized tasks") t <- assessmentTest(list(s), title = "Example of the Exam")
Class AssessmentTest is responsible for creating XML exam files according
to the QTI 2.1 standard.
Test consists of one or more sections. Each section can have one or more questions/tasks and/or one or more sub sections.
identifierA character representing the unique identifier of the assessment test. By default, it is generated as 'id_test_dddd', where dddd represents random digits.
titleA character representing the title of the test. By default, it takes the value of the identifier.
pointsDo not use directly; the maximum number of points for the exam/test. It is calculated automatically as a sum of points of included tasks.
test_part_identifierA character representing the identifier of the test part.
navigation_modeA character value, optional, determining the general paths that the candidate may have during the exam. Possible values:
"linear" - candidate is not allowed to return to the previous questions.
"nonlinear" - candidate is free to navigate. This is used by default.
submission_modeA character value, optional, determining when the candidate's responses are submitted for response processing. Possible values:
"individual" - submit candidates' responses on an item-by-item basis. This is used by default.
"simultaneous" - candidates' responses are submitted all together by the end of the test.
sectionA list containing one or more AssessmentSection objects.
time_limitA numeric value, optional, controlling the amount of time in minutes which a candidate is allowed for this part of the test.
max_attemptsA numeric value, optional, enabling the maximum number of attempts that a candidate is allowed to make.
allow_commentA boolean value, optional, allowing candidates to leave comments on each question.
rebuild_variablesA boolean value, optional, allowing variables to be recalculated and the order of choices to be reshuffled for each item attempt.
fallback_titlesA character value, optional, controlling how titles are assigned when no explicit title is provided. Possible values are "filename" (use filenames as titles) and "generic" (use generic labels such as "Section 1", "Section 1.2", or "Task 1.2.1"). Default is "generic".
academic_gradingA named numeric vector that defines the grade table shown to the candidate as feedback at the end of the test.
Each grade corresponds to the minimum percentage score required to achieve it.
A helper function german_grading() is available to generate a common
German grading scheme.
The default is NULL, which means that no grading table is shown.
To display a grading table, provide a named numeric vector or use
german_grading().
grade_labelA character value, optional, representing a short message to display with a grade in the final feedback. For multilingual usage, it has to be a named vector with two-letter ISO language codes as names (e.g., c(en="Grade", de="Note")); during test creation, it takes the value for the language of the operating system. Default is c(en="Grade", de="Note").
table_labelA character value, optional, representing a concise message to display as the column title of the grading table in the final feedback. For multilingual usage, it has to be a named vector with two-letter ISO language codes as names (e.g., c(en="Grade", de="Note")); during test creation, it takes the value for the language of the operating system. Default is c(en="Grade", de="Note").
stylesheet_pathA character value, optional, specifying the path to a
custom CSS stylesheet. If provided, the stylesheet is included at the
assessment test level and applied during rendering. When
academic_grading is set, the default stylesheet
styles/rqti.css is included automatically; a user-defined stylesheet
is added in addition and may override default styles.
metadataAn object of class QtiMetadata that holds metadata information about the test.
AssessmentSection, AssessmentTestOpal, test(), test4opal(),
section().
# This example creates test 'exam' with one section 'exam_section' which # consists of two questions/tasks: essay and single choice types task1 <- new("Essay", prompt = "Test task", title = "Essay", identifier = "q1") task2 <- new("SingleChoice", prompt = "Test task", title = "SingleChoice", choices = c("A", "B", "C"), identifier = "q2") exam_section <- new("AssessmentSection", identifier = "sec_id", title = "section", assessment_item = list(task1, task2)) exam <- new("AssessmentTest", identifier = "id_test_1234", title = "Example of Exam", navigation_mode = "linear", submission_mode = "individual", section = list(exam_section), time_limit = 90, max_attempts = 1, grade_label = "Preliminary grade")# This example creates test 'exam' with one section 'exam_section' which # consists of two questions/tasks: essay and single choice types task1 <- new("Essay", prompt = "Test task", title = "Essay", identifier = "q1") task2 <- new("SingleChoice", prompt = "Test task", title = "SingleChoice", choices = c("A", "B", "C"), identifier = "q2") exam_section <- new("AssessmentSection", identifier = "sec_id", title = "section", assessment_item = list(task1, task2)) exam <- new("AssessmentTest", identifier = "id_test_1234", title = "Example of Exam", navigation_mode = "linear", submission_mode = "individual", section = list(exam_section), time_limit = 90, max_attempts = 1, grade_label = "Preliminary grade")
Create an AssessmentTestOpal rqti-object.
assessmentTestOpal( section, identifier = generate_id(type = "test"), title = identifier, time_limit = NULL, max_attempts = 1L, fallback_titles = "generic", academic_grading = NULL, grade_label = c(en = "Grade", de = "Note"), table_label = c(en = "Grade", de = "Note"), navigation_mode = "nonlinear", submission_mode = "individual", allow_comment = TRUE, rebuild_variables = TRUE, show_test_time = TRUE, calculator = NA_character_, mark_items = TRUE, keep_responses = FALSE, files = character(), stylesheet_path = NULL, metadata = qtiMetadata(), points = NA_real_ )assessmentTestOpal( section, identifier = generate_id(type = "test"), title = identifier, time_limit = NULL, max_attempts = 1L, fallback_titles = "generic", academic_grading = NULL, grade_label = c(en = "Grade", de = "Note"), table_label = c(en = "Grade", de = "Note"), navigation_mode = "nonlinear", submission_mode = "individual", allow_comment = TRUE, rebuild_variables = TRUE, show_test_time = TRUE, calculator = NA_character_, mark_items = TRUE, keep_responses = FALSE, files = character(), stylesheet_path = NULL, metadata = qtiMetadata(), points = NA_real_ )
section |
A list containing AssessmentSection objects. |
identifier |
A character value indicating the identifier of the test file. By default, it is generated as 'id_test_dddd', where dddd represents random digits. |
title |
A character value, optional, representing the file title. By default, it takes the value of the identifier. |
time_limit |
An integer value, optional, controlling the time given to a
candidate for the test in minutes. Default is |
max_attempts |
An integer value, optional, indicating the maximum number of attempts allowed for the candidate. Default is 1. |
fallback_titles |
A character value, optional, controlling how titles are assigned when no explicit title is provided. Possible values are "filename" (use filenames as titles) and "generic" (use generic labels such as "Section 1", "Section 1.2", or "Task 1.2.1"). Default is "generic". |
academic_grading |
A named numeric vector that defines the grade table shown to the candidate as feedback at the end of the test. Each grade corresponds to the minimum percentage score required to achieve it.
A helper function The default is |
grade_label |
A character value, optional; a short message that shows with a grade in the final feedback; for multilingual use, it can be a named vector with two-letter ISO language codes as names (e.g., c(en="Grade", de="Note")); during test creation, it takes the value for the language of the operating system; c(en="Grade", de="Note")is default. |
table_label |
A character value, optional; a concise message to display as the column title of the grading table in the final feedback; for multilingual use, it can be a named vector with two-letter ISO language codes as names (e.g., c(en="Grade", de="Note")); during test creation, it takes the value for the language of the operating system; c(en="Grade", de="Note")is default. |
navigation_mode |
A character value, optional, determining the general paths that the candidate may have during the exam. Two mode options are possible:
|
submission_mode |
A character value, optional, determining when the candidate's responses are submitted for response processing. One of two mode options is possible:
|
allow_comment |
A boolean, optional, allowing the candidate to leave
comments on each question. Default is |
rebuild_variables |
A boolean, optional, enabling the recalculation of
variables and reshuffling the order of choices for each item-attempt.
Default is |
show_test_time |
A boolean, optional, determining whether to show
the candidate's elapsed processing time without a time limit. Default is |
calculator |
A character value, optional, determining whether to show a calculator to the candidate. Possible values: - "simple" - "scientific". |
mark_items |
A boolean, optional, determining whether to allow
candidates to mark questions. Default is |
keep_responses |
A boolean, optional, determining whether to save the
the candidate's answers from the previous attempt. Default is |
files |
A character vector, optional; paths to files that will be available for download in OPAL. |
stylesheet_path |
A character value, optional, specifying the path to a
custom CSS stylesheet. If provided, the stylesheet is included at the
assessment test level and applied during rendering. When
|
metadata |
An object of class QtiMetadata that holds metadata
information about the test. By default it creates QtiMetadata object. See
|
points |
Do not use directly; the maximum number of points for the exam/test. It is calculated automatically as a sum of points of included tasks. |
An AssessmentTestOpal object.
test(), test4opal(), section(), assessmentTest(), AssessmentTest,
AssessmentSection
sc <- sc <- singleChoice(prompt = "Question", choices = c("A", "B", "C")) es <- new("Essay", prompt = "Question") s <- section(c(sc, es), title = "Section with nonrandomized tasks") t <- assessmentTest(list(s), title = "Example of the Exam")sc <- sc <- singleChoice(prompt = "Question", choices = c("A", "B", "C")) es <- new("Essay", prompt = "Question") s <- section(c(sc, es), title = "Section with nonrandomized tasks") t <- assessmentTest(list(s), title = "Example of the Exam")
Class AssessmentTestOpal is responsible for creating XML exam files
according to the QTI 2.1 standard for LMS Opal.
Test consists of one or more sections. Each section can have one or more questions/tasks and/or one or more sub sections.
identifierA character representing the unique identifier of the assessment test. By default, it is generated as 'id_test_dddd', where dddd represents random digits.
titleA character representing the title of the test. By default, it takes the value of the identifier.
pointsDo not use directly; the maximum number of points for the exam/test. It is calculated automatically as a sum of points of included tasks.
test_part_identifierA character representing the identifier of the test part.
navigation_modeA character value, optional, determining the general paths that the candidate may have during the exam. Possible values:
"linear" - candidate is not allowed to return to the previous questions.
"nonlinear" - candidate is free to navigate. This is used by default.
submission_modeA character value, optional, determining when the candidate's responses are submitted for response processing. Possible values:
"individual" - submit candidates' responses on an item-by-item basis. This is used by default.
"simultaneous" - candidates' responses are submitted all together by the end of the test.
sectionA list containing one or more AssessmentSection objects.
time_limitA numeric value, optional, controlling the amount of time in minutes which a candidate is allowed for this part of the test.
max_attemptsA numeric value, optional, enabling the maximum number of attempts that a candidate is allowed to make.
allow_commentA boolean value, optional, allowing candidates to leave comments on each question.
rebuild_variablesA boolean value, optional, allowing variables to be recalculated and the order of choices to be reshuffled for each item attempt.
fallback_titlesA character value, optional, controlling how titles are assigned when no explicit title is provided. Possible values are "filename" (use filenames as titles) and "generic" (use generic labels such as "Section 1", "Section 1.2", or "Task 1.2.1"). Default is "generic".
academic_gradingA named numeric vector that defines the grade table shown to the candidate as feedback at the end of the test.
Each grade corresponds to the minimum percentage score required to achieve it.
A helper function german_grading() is available to generate a common
German grading scheme.
The default is NULL, which means that no grading table is shown.
To display a grading table, provide a named numeric vector or use
german_grading().
grade_labelA character value, optional, representing a short message to display with a grade in the final feedback. For multilingual usage, it has to be a named vector with two-letter ISO language codes as names (e.g., c(en="Grade", de="Note")); during test creation, it takes the value for the language of the operating system. Default is c(en="Grade", de="Note").
table_labelA character value, optional, representing a concise message to display as the column title of the grading table in the final feedback. For multilingual usage, it has to be a named vector with two-letter ISO language codes as names (e.g., c(en="Grade", de="Note")); during test creation, it takes the value for the language of the operating system. Default is c(en="Grade", de="Note").
stylesheet_pathA character value, optional, specifying the path to a
custom CSS stylesheet. If provided, the stylesheet is included at the
assessment test level and applied during rendering. When
academic_grading is set, the default stylesheet
styles/rqti.css is included automatically; a user-defined stylesheet
is added in addition and may override default styles.
metadataAn object of class QtiMetadata that holds metadata information about the test.
show_test_timeA boolean value, optional, determining whether to show
the candidate's elapsed processing time without a time limit. Default is
FALSE.
calculatorA character value, optional, determining whether to show a calculator to the candidate. Possible values:
"simple"
"scientific".
mark_itemsA boolean value, optional, determining whether to allow
candidates to mark questions. Default is TRUE.
keep_responsesA boolean value, optional, determining whether to save
the candidate's answers from the previous attempt. Default is FALSE.
filesA character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam.
AssessmentSection, AssessmentTest, test(), test4opal(),
section().
# This example creates test 'exam' with one section 'exam_section' which # consists of two questions/tasks: essay and single choice types task1 <- new("Essay", prompt = "Test task", title = "Essay", identifier = "q1") task2 <- new("SingleChoice", prompt = "Test task", title = "SingleChoice", choices = c("A", "B", "C"), identifier = "q2") exam_section <- new("AssessmentSection", identifier = "sec_id", title = "section", assessment_item = list(task1, task2)) exam <- new("AssessmentTestOpal", identifier = "id_test_1234", title = "Example of Exam", navigation_mode = "linear", submission_mode = "individual", section = list(exam_section), time_limit = 90, max_attempts = 1, grade_label = "Preliminary grade", show_test_time = TRUE, calculator = "scientific-calculator", mark_items = TRUE, files = "text_book.pdf")# This example creates test 'exam' with one section 'exam_section' which # consists of two questions/tasks: essay and single choice types task1 <- new("Essay", prompt = "Test task", title = "Essay", identifier = "q1") task2 <- new("SingleChoice", prompt = "Test task", title = "SingleChoice", choices = c("A", "B", "C"), identifier = "q2") exam_section <- new("AssessmentSection", identifier = "sec_id", title = "section", assessment_item = list(task1, task2)) exam <- new("AssessmentTestOpal", identifier = "id_test_1234", title = "Example of Exam", navigation_mode = "linear", submission_mode = "individual", section = list(exam_section), time_limit = 90, max_attempts = 1, grade_label = "Preliminary grade", show_test_time = TRUE, calculator = "scientific-calculator", mark_items = TRUE, files = "text_book.pdf")
Create an AssessmentTestOpenOlat rqti-object.
assessmentTestOpenOlat( section, identifier = generate_id(type = "test"), title = identifier, time_limit = NULL, max_attempts = 1L, fallback_titles = "generic", academic_grading = NULL, grade_label = c(en = "Grade", de = "Note"), table_label = c(en = "Grade", de = "Note"), navigation_mode = "nonlinear", submission_mode = "individual", allow_comment = TRUE, rebuild_variables = TRUE, metadata = qtiMetadata(), points = NA_real_, cancel = FALSE, suspend = FALSE, scoreprogress = FALSE, questionprogress = FALSE, maxscoreitem = TRUE, menu = TRUE, titles = TRUE, notes = FALSE, hidelms = TRUE, hidefeedbacks = FALSE, blockaftersuccess = FALSE, attempts = 1L, anonym = FALSE, manualcorrect = FALSE )assessmentTestOpenOlat( section, identifier = generate_id(type = "test"), title = identifier, time_limit = NULL, max_attempts = 1L, fallback_titles = "generic", academic_grading = NULL, grade_label = c(en = "Grade", de = "Note"), table_label = c(en = "Grade", de = "Note"), navigation_mode = "nonlinear", submission_mode = "individual", allow_comment = TRUE, rebuild_variables = TRUE, metadata = qtiMetadata(), points = NA_real_, cancel = FALSE, suspend = FALSE, scoreprogress = FALSE, questionprogress = FALSE, maxscoreitem = TRUE, menu = TRUE, titles = TRUE, notes = FALSE, hidelms = TRUE, hidefeedbacks = FALSE, blockaftersuccess = FALSE, attempts = 1L, anonym = FALSE, manualcorrect = FALSE )
section |
A list containing AssessmentSection objects. |
identifier |
A character value indicating the identifier of the test file. By default, it is generated as 'id_test_dddd', where dddd represents random digits. |
title |
A character value, optional, representing the file title. By default, it takes the value of the identifier. |
time_limit |
An integer value, optional, controlling the time given to a candidate for the test in minutes. Default is 90 minutes. |
max_attempts |
An integer value, optional, indicating the maximum number of attempts allowed for the candidate. Default is 1. |
fallback_titles |
A character value, optional, controlling how titles are assigned when no explicit title is provided. Possible values are "filename" (use filenames as titles) and "generic" (use generic labels such as "Section 1", "Section 1.2", or "Task 1.2.1"). Default is "generic". |
academic_grading |
A named numeric vector that defines the grade table shown to the candidate as feedback at the end of the test. Each grade corresponds to the minimum percentage score required to achieve it.
A helper function The default is |
grade_label |
A character value, optional; a short message that shows with a grade in the final feedback; for multilingual use, it can be a named vector with two-letter ISO language codes as names (e.g., c(en="Grade", de="Note")); during test creation, it takes the value for the language of the operating system; c(en="Grade", de="Note")is default. |
table_label |
A character value, optional; a concise message to display as the column title of the grading table in the final feedback; for multilingual use, it can be a named vector with two-letter ISO language codes as names (e.g., c(en="Grade", de="Note")); during test creation, it takes the value for the language of the operating system; c(en="Grade", de="Note")is default. |
navigation_mode |
A character value, optional, determining the general paths that the candidate may have during the exam. Two mode options are possible:
|
submission_mode |
A character value, optional, determining when the candidate's responses are submitted for response processing. One of two mode options is possible:
|
allow_comment |
A boolean, optional, allowing the candidate to leave
comments on each question. Default is |
rebuild_variables |
A boolean, optional, enabling the recalculation of
variables and reshuffling the order of choices for each item-attempt.
Default is |
metadata |
An object of class QtiMetadata that holds metadata
information about the test. By default it creates QtiMetadata object. See
|
points |
Do not use directly; the maximum number of points for the exam/test. It is calculated automatically as a sum of points of included tasks. |
cancel |
A logical value, optional, indicating whether participants are
allowed to cancel an exam after starting it. Default is |
suspend |
A logical value, optional, indicating whether participants are
allowed to suspend an exam after starting it and continue later. Default is
|
scoreprogress |
A logical value, optional, indicating whether the
progress of the score achieved so far should be displayed during the exam.
Default is |
questionprogress |
A logical value, optional, indicating whether the
number of solved questions should be displayed during the exam. Default is
|
maxscoreitem |
A logical value, optional, indicating whether the maximum
score of an item should be displayed. Default is |
menu |
A logical value, optional, indicating whether the menu should be
displayed during the exam. Default is |
titles |
A logical value, optional, indicating whether question titles
should be displayed during the exam. Default is |
notes |
A logical value, optional, indicating whether participants can
take notes in OpenOlat during the exam. Default is |
hidelms |
A logical value, optional, indicating whether access to the
OpenOlat learning management system should be hidden during the exam.
Default is |
hidefeedbacks |
A logical value, optional, indicating whether feedback
should be hidden. Default is |
blockaftersuccess |
A logical value, optional, indicating whether the
exam should be blocked after successful completion. Default is |
attempts |
An integer value, optional, indicating how many attempts are
allowed for the exam as a whole. Default is |
anonym |
A logical value, optional, indicating whether anonymous users
are allowed to take the exam. Default is |
manualcorrect |
A logical value, optional, indicating whether points and
pass/fail status should be evaluated manually. Default is |
An AssessmentTestOpenOlat object.
test(), section(), assessmentTest(), AssessmentTest,
AssessmentSection
sc <- sc <- singleChoice(prompt = "Question", choices = c("A", "B", "C")) es <- new("Essay", prompt = "Question") s <- section(c(sc, es), title = "Section with nonrandomized tasks") t <- assessmentTestOpenOlat(list(s), title = "Example of the Exam")sc <- sc <- singleChoice(prompt = "Question", choices = c("A", "B", "C")) es <- new("Essay", prompt = "Question") s <- section(c(sc, es), title = "Section with nonrandomized tasks") t <- assessmentTestOpenOlat(list(s), title = "Example of the Exam")
Class AssessmentTestOpenOlat is responsible for creating XML exam files
according to the QTI 2.1 standard for LMS OpenOlat.
Test consists of one or more sections. Each section can have one or more questions/tasks and/or one or more sub sections.
identifierA character representing the unique identifier of the assessment test. By default, it is generated as 'id_test_dddd', where dddd represents random digits.
titleA character representing the title of the test. By default, it takes the value of the identifier.
pointsDo not use directly; the maximum number of points for the exam/test. It is calculated automatically as a sum of points of included tasks.
test_part_identifierA character representing the identifier of the test part.
navigation_modeA character value, optional, determining the general paths that the candidate may have during the exam. Possible values:
"linear" - candidate is not allowed to return to the previous questions.
"nonlinear" - candidate is free to navigate. This is used by default.
submission_modeA character value, optional, determining when the candidate's responses are submitted for response processing. Possible values:
"individual" - submit candidates' responses on an item-by-item basis. This is used by default.
"simultaneous" - candidates' responses are submitted all together by the end of the test.
sectionA list containing one or more AssessmentSection objects.
time_limitA numeric value, optional, controlling the amount of time in minutes which a candidate is allowed for this part of the test.
max_attemptsA numeric value, optional, enabling the maximum number of attempts that a candidate is allowed to make.
allow_commentA boolean value, optional, allowing candidates to leave comments on each question.
rebuild_variablesA boolean value, optional, allowing variables to be recalculated and the order of choices to be reshuffled for each item attempt.
fallback_titlesA character value, optional, controlling how titles are assigned when no explicit title is provided. Possible values are "filename" (use filenames as titles) and "generic" (use generic labels such as "Section 1", "Section 1.2", or "Task 1.2.1"). Default is "generic".
academic_gradingA named numeric vector that defines the grade table shown to the candidate as feedback at the end of the test.
Each grade corresponds to the minimum percentage score required to achieve it.
A helper function german_grading() is available to generate a common
German grading scheme.
The default is NULL, which means that no grading table is shown.
To display a grading table, provide a named numeric vector or use
german_grading().
grade_labelA character value, optional, representing a short message to display with a grade in the final feedback. For multilingual usage, it has to be a named vector with two-letter ISO language codes as names (e.g., c(en="Grade", de="Note")); during test creation, it takes the value for the language of the operating system. Default is c(en="Grade", de="Note").
table_labelA character value, optional, representing a concise message to display as the column title of the grading table in the final feedback. For multilingual usage, it has to be a named vector with two-letter ISO language codes as names (e.g., c(en="Grade", de="Note")); during test creation, it takes the value for the language of the operating system. Default is c(en="Grade", de="Note").
stylesheet_pathA character value, optional, specifying the path to a
custom CSS stylesheet. If provided, the stylesheet is included at the
assessment test level and applied during rendering. When
academic_grading is set, the default stylesheet
styles/rqti.css is included automatically; a user-defined stylesheet
is added in addition and may override default styles.
metadataAn object of class QtiMetadata that holds metadata information about the test.
cancelA logical value, optional, indicating whether participants are
allowed to cancel an exam after starting it. Default is FALSE.
suspendA logical value, optional, indicating whether participants are
allowed to suspend an exam after starting it and continue later.
Default is FALSE.
scoreprogressA logical value, optional, indicating whether the
progress of the score achieved so far should be displayed during the exam.
Default is FALSE.
questionprogressA logical value, optional, indicating whether the
number of solved questions should be displayed during the exam.
Default is FALSE.
maxscoreitemA logical value, optional, indicating whether the maximum
score of an item should be displayed. Default is TRUE.
menuA logical value, optional, indicating whether the menu should be
displayed during the exam. Default is TRUE.
titlesA logical value, optional, indicating whether question titles
should be displayed during the exam. Default is TRUE.
notesA logical value, optional, indicating whether participants can
take notes in OpenOlat during the exam. Default is FALSE.
hidelmsA logical value, optional, indicating whether access to the
OpenOlat learning management system should be hidden during the exam.
Default is TRUE.
hidefeedbacksA logical value, optional, indicating whether feedback
should be hidden. Default is FALSE.
blockaftersuccessA logical value, optional, indicating whether the
exam should be blocked after successful completion. Default is FALSE.
attemptsAn integer value, optional, indicating how many attempts are
allowed for the exam as a whole. Default is 1.
anonymA logical value, optional, indicating whether anonymous users
are allowed to take the exam. Default is FALSE.
manualcorrectA logical value, optional, indicating whether points and
pass/fail status should be evaluated manually. Default is FALSE.
AssessmentSection, AssessmentTest, section().
# This example creates test 'exam' with one section 'exam_section' which # consists of two questions/tasks: essay and single choice types task1 <- new("Essay", prompt = "Test task", title = "Essay", identifier = "q1") task2 <- new("SingleChoice", prompt = "Test task", title = "SingleChoice", choices = c("A", "B", "C"), identifier = "q2") exam_section <- new("AssessmentSection", identifier = "sec_id", title = "section", assessment_item = list(task1, task2)) exam <- new("AssessmentTestOpenOlat", identifier = "id_test_1234", title = "Example of Exam", navigation_mode = "linear", submission_mode = "individual", section = list(exam_section), time_limit = 90, max_attempts = 1, grade_label = "Preliminary grade")# This example creates test 'exam' with one section 'exam_section' which # consists of two questions/tasks: essay and single choice types task1 <- new("Essay", prompt = "Test task", title = "Essay", identifier = "q1") task2 <- new("SingleChoice", prompt = "Test task", title = "SingleChoice", choices = c("A", "B", "C"), identifier = "q2") exam_section <- new("AssessmentSection", identifier = "sec_id", title = "section", assessment_item = list(task1, task2)) exam <- new("AssessmentTestOpenOlat", identifier = "id_test_1234", title = "Example of Exam", navigation_mode = "linear", submission_mode = "individual", section = list(exam_section), time_limit = 90, max_attempts = 1, grade_label = "Preliminary grade")
A generic function to handle authentication with a Learning Management System (LMS).
The method to handle authentication with LMS.
authLMS(object, ...) ## S4 method for signature 'LMS' authLMS(object, ...)authLMS(object, ...) ## S4 method for signature 'LMS' authLMS(object, ...)
object |
|
... |
Additional arguments to be passed to the method, if applicable. |
Generic function for tags that contain assessmentSection in assessmentTest
buildAssessmentSection(object, folder = NULL, verify = FALSE) ## S4 method for signature 'AssessmentItem' buildAssessmentSection(object, folder) ## S4 method for signature 'AssessmentSection' buildAssessmentSection(object, folder = NULL, verify = FALSE) ## S4 method for signature 'character' buildAssessmentSection(object, folder = NULL, verify = FALSE)buildAssessmentSection(object, folder = NULL, verify = FALSE) ## S4 method for signature 'AssessmentItem' buildAssessmentSection(object, folder) ## S4 method for signature 'AssessmentSection' buildAssessmentSection(object, folder = NULL, verify = FALSE) ## S4 method for signature 'character' buildAssessmentSection(object, folder = NULL, verify = FALSE)
object |
an instance of the S4 object (AssessmentSection and all types of AssessmentItem) |
folder |
string; a folder to store xml file |
verify |
boolean, optional; check validity of xml file, default |
Abstract class Choice is not meant to be instantiated directly; instead, it
serves as a base for derived classes SingleChoice and
MultipleChoice.
choicesA character vector defining a set of answer options in the question.
choice_identifiersA character vector, optional, containing a set of identifiers for answers. By default, identifiers are generated automatically according to the template "ChoiceD", where D is a letter representing the alphabetical order of the answer in the list.
shuffleA boolean value indicating whether to randomize the order in
which the choices are initially presented to the candidate. Default is
TRUE.
orientationA character, determining whether to place answers in vertical or horizontal mode. Possible values:
"vertical" - Default.
"horizontal"
Create object CorrectFeedback
correctFeedback(content = list(), title = character(0), show = TRUE)correctFeedback(content = list(), title = character(0), show = TRUE)
content |
A character string or a list of character strings to form the text of the question, which may include HTML tags. |
title |
A character value, optional, representing the title of the feedback window. |
show |
A boolean value, optional, determining whether to show ( |
An object of class CorrectFeedback
cfb <- correctFeedback(content = "Some comments", title = "Feedback")cfb <- correctFeedback(content = "Some comments", title = "Feedback")
Class CorrectFeedback is responsible for delivering feedback messages to
the candidate in case of a correct answer on the entire exercise.
outcome_identifierA character representing the unique identifier of the outcome declaration variable that relates to feedback. Default is "FEEDBACKMODAL".
showA boolean value, optional, determining whether to show (TRUE) or
hide (FALSE) the modal feedback. Default is TRUE.
titleA character value, optional, representing the title of the modal feedback window.
contentA list of character content to form the text of the modal feedback, which can include HTML tags.
identifierA character value representing the identifier of the modal feedback item. Default is "correct". cfb <- new("CorrectFeedback", title = "Right answer", content = list("Some demonstration"))
create_assessment_item() creates html structure with AssessmentItem root
element (shiny.tag) for xml qti task description according QTI 2.1
create_assessment_item(object)create_assessment_item(object)
object |
an instance of the S4 object |
A list() with a shiny.tag class
Create XML file for question specification
create_qti_task(object, dir = NULL, verification = FALSE)create_qti_task(object, dir = NULL, verification = FALSE)
object |
an instance of the S4 object (SingleChoice, MultipleChoice, Essay, Entry, Ordering, OneInRowTable, OneInColTable, MultipleChoiceTable, DirectedPair). |
dir |
string, optional; a folder to store xml file; working directory by default |
verification |
boolean, optional; to check validity of xml file, default
|
xml document.
Create XML file for exam test specification
create_qti_test(object, path = ".", verification = FALSE, zip_only = FALSE)create_qti_test(object, path = ".", verification = FALSE, zip_only = FALSE)
object |
an instance of the AssessmentTest S4 object |
path |
string, optional; a path to folder to store zip file with possible file name; working directory by default |
verification |
boolean, optional; checks the validity of the XML file.
Default is |
zip_only |
boolean, optional; if TRUE, returns only the zip file. If FALSE, returns the zip, XML, and download files. |
xml document.
Generates an rqti S4 AssessmentItem object (SingleChoice, MultipleChoice, Essay, Entry, Ordering, OneInRowTable, OneInColTable, MultipleChoiceTable, DirectedPair) from an Rmd file.
create_question_object(file)create_question_object(file)
file |
A string representing the path to an Rmd file. |
One of the rqti S4 AssessmentItem objects: SingleChoice, MultipleChoice, Essay, Entry, Ordering, OneInRowTable, OneInColTable, MultipleChoiceTable, or DirectedPair.
Use stylesheet_path: styles.css for a CSS file (or a YAML sequence of
files). Relative paths are resolved against the Rmd file's directory.
Use a YAML literal block css: | for CSS text. When both are supplied,
files are linked in the supplied order, followed by the CSS text.
Stylesheets are linked from the assessment item and included in QTI ZIPs
and their manifests. Standalone XML exports write CSS beside the XML in
a styles/items/ subdirectory; keep that directory with the XML.
These fields do not convert inline HTML style attributes to classes.
CSS references such as url(...) and @import are not collected or
rewritten; use self-contained stylesheets. Rendering depends on the
delivery platform's CSS support.
create_question_object("file.Rmd")create_question_object("file.Rmd")
Generic function for creating assessmentTest element for XML document of specification the test following the QTI schema v2.1
createAssessmentTest(object, folder, verify = FALSE) ## S4 method for signature 'AssessmentTest' createAssessmentTest(object, folder, verify = FALSE) ## S4 method for signature 'AssessmentTestOpal' createAssessmentTest(object, folder, verify = FALSE)createAssessmentTest(object, folder, verify = FALSE) ## S4 method for signature 'AssessmentTest' createAssessmentTest(object, folder, verify = FALSE) ## S4 method for signature 'AssessmentTestOpal' createAssessmentTest(object, folder, verify = FALSE)
object |
an instance of the S4 object AssessmentTest or AssessmentTestOpal |
folder |
string, optional; a folder to store xml file; working directory by default |
verify |
boolean, optional; to check validity of xml file, default
|
Generic function for creating additional configuration file for the archive with test
createConfigurationFile(object, output) ## S4 method for signature 'AssessmentTest' createConfigurationFile(object, output) ## S4 method for signature 'AssessmentTestOpenOlat' createConfigurationFile(object, output)createConfigurationFile(object, output) ## S4 method for signature 'AssessmentTest' createConfigurationFile(object, output) ## S4 method for signature 'AssessmentTestOpenOlat' createConfigurationFile(object, output)
object |
an instance of the S4 object AssessmentTest |
output |
string, a folder to store an xml configuration files |
This method creates a group in a course on the Learning Management System (LMS). If no LMS connection object is provided, it attempts to guess the connection using default settings (e.g., environment variables). If the connection cannot be established, an error is thrown.
This method creates a learning group in an LMS Opal course using OPAL's
GroupVO XML representation. The group name must be unique within the
course. invitationEnabled controls whether new group members receive an
invitation that has to be accepted; signoutEnabled controls whether members
may leave the group themselves.
createCourseGroup(object, course_id, name, ...) ## S4 method for signature 'missing' createCourseGroup(object, course_id, name, ...) ## S4 method for signature 'Opal' createCourseGroup( object, course_id, name, description = "", minParticipants = 0, maxParticipants = 0, invitationEnabled = TRUE, signoutEnabled = TRUE )createCourseGroup(object, course_id, name, ...) ## S4 method for signature 'missing' createCourseGroup(object, course_id, name, ...) ## S4 method for signature 'Opal' createCourseGroup( object, course_id, name, description = "", minParticipants = 0, maxParticipants = 0, invitationEnabled = TRUE, signoutEnabled = TRUE )
object |
An S4 object of class Opal that represents a connection to the LMS. |
course_id |
A character vector of length one specifying the course resource ID. Note that this is not the course ID shown in the URL, but a longer identifier available via the "Show more information" option within the course. |
name |
A character vector of length one with the group name. |
... |
Additional arguments to be passed to the method, if applicable. |
description |
A character vector of length one with the group description. Defaults to an empty string. |
minParticipants |
A numeric value with the minimum number of
participants. Defaults to |
maxParticipants |
A numeric value with the maximum number of
participants. Defaults to |
invitationEnabled |
A boolean value. If |
signoutEnabled |
A boolean value. If |
A data frame with the created group attributes.
A one-row data frame with the created group attributes, or NULL
when OPAL rejects the request.
group <- createCourseGroup("89068111333293", "Topic 5") group <- createCourseGroup( "89068111333293", "Topic 5", description = "Group for topic 5", minParticipants = 1, maxParticipants = 1, invitationEnabled = FALSE, signoutEnabled = FALSE )group <- createCourseGroup("89068111333293", "Topic 5") group <- createCourseGroup( "89068111333293", "Topic 5", description = "Group for topic 5", minParticipants = 1, maxParticipants = 1, invitationEnabled = FALSE, signoutEnabled = FALSE )
Generic function for creating itemBody element for XML document of specification the question following the QTI schema v2.1
createItemBody(object) ## S4 method for signature 'DirectedPair' createItemBody(object) ## S4 method for signature 'Entry' createItemBody(object) ## S4 method for signature 'Essay' createItemBody(object) ## S4 method for signature 'MultipleChoice' createItemBody(object) ## S4 method for signature 'MultipleChoiceTable' createItemBody(object) ## S4 method for signature 'OneInColTable' createItemBody(object) ## S4 method for signature 'OneInRowTable' createItemBody(object) ## S4 method for signature 'Ordering' createItemBody(object) ## S4 method for signature 'SingleChoice' createItemBody(object)createItemBody(object) ## S4 method for signature 'DirectedPair' createItemBody(object) ## S4 method for signature 'Entry' createItemBody(object) ## S4 method for signature 'Essay' createItemBody(object) ## S4 method for signature 'MultipleChoice' createItemBody(object) ## S4 method for signature 'MultipleChoiceTable' createItemBody(object) ## S4 method for signature 'OneInColTable' createItemBody(object) ## S4 method for signature 'OneInRowTable' createItemBody(object) ## S4 method for signature 'Ordering' createItemBody(object) ## S4 method for signature 'SingleChoice' createItemBody(object)
object |
an instance of the S4 object (SingleChoice, MultipleChoice, Essay, Entry, Ordering, OneInRowTable, OneInColTable, MultipleChoiceTable, DirectedPair) |
Create an element of metadata
createMetadata(object) ## S4 method for signature 'QtiContributor' createMetadata(object) ## S4 method for signature 'AssessmentItem' createMetadata(object) ## S4 method for signature 'AssessmentTest' createMetadata(object)createMetadata(object) ## S4 method for signature 'QtiContributor' createMetadata(object) ## S4 method for signature 'AssessmentItem' createMetadata(object) ## S4 method for signature 'AssessmentTest' createMetadata(object)
object |
an instance of the S4 object (QtiContributor, QtiMetadata |
Generic function for creating outcomeDeclaration element for XML document of specification the question following the QTI schema v2.1
createOutcomeDeclaration(object) ## S4 method for signature 'AssessmentItem' createOutcomeDeclaration(object) ## S4 method for signature 'AssessmentTest' createOutcomeDeclaration(object) ## S4 method for signature 'Entry' createOutcomeDeclaration(object) ## S4 method for signature 'Gap' createOutcomeDeclaration(object) ## S4 method for signature 'MultipleChoice' createOutcomeDeclaration(object) ## S4 method for signature 'SingleChoice' createOutcomeDeclaration(object)createOutcomeDeclaration(object) ## S4 method for signature 'AssessmentItem' createOutcomeDeclaration(object) ## S4 method for signature 'AssessmentTest' createOutcomeDeclaration(object) ## S4 method for signature 'Entry' createOutcomeDeclaration(object) ## S4 method for signature 'Gap' createOutcomeDeclaration(object) ## S4 method for signature 'MultipleChoice' createOutcomeDeclaration(object) ## S4 method for signature 'SingleChoice' createOutcomeDeclaration(object)
object |
an instance of the S4 object (SingleChoice, MultipleChoice, Essay, Entry, Ordering, OneInRowTable, OneInColTable, MultipleChoiceTable, DirectedPair, TextGap, NumericGap, InlineChoice) |
Create XML or zip file for question specification
createQtiTask(object, dir = ".", verification = FALSE, zip = FALSE) ## S4 method for signature 'AssessmentItem' createQtiTask(object, dir = ".", verification = FALSE, zip = FALSE) ## S4 method for signature 'character' createQtiTask(object, dir = getwd(), verification = FALSE, zip = FALSE)createQtiTask(object, dir = ".", verification = FALSE, zip = FALSE) ## S4 method for signature 'AssessmentItem' createQtiTask(object, dir = ".", verification = FALSE, zip = FALSE) ## S4 method for signature 'character' createQtiTask(object, dir = getwd(), verification = FALSE, zip = FALSE)
object |
An instance of the S4 object (SingleChoice, MultipleChoice, Essay, Entry, Ordering, OneInRowTable, OneInColTable, MultipleChoiceTable, DirectedPair). |
dir |
A character value, optional; a folder to store xml file; working directory is used by default. |
verification |
A boolean value, optional; checks the validity of the XML file.
Default is |
zip |
A boolean value, optional; |
A path to xml or zip file.
essay <- new("Essay", prompt = "Test task", title = "Essay") ## Not run: # creates folder with XML (side effect) createQtiTask(essay, "result") # creates folder with zip (side effect) createQtiTask(essay, "result", zip = TRUE) ## End(Not run)essay <- new("Essay", prompt = "Test task", title = "Essay") ## Not run: # creates folder with XML (side effect) createQtiTask(essay, "result") # creates folder with zip (side effect) createQtiTask(essay, "result", zip = TRUE) ## End(Not run)
Create zip-archive of the qti test specification
createQtiTest(object, dir = NULL, verification = FALSE, zip_only = FALSE) ## S4 method for signature 'AssessmentItem' createQtiTest(object, dir = ".", verification = FALSE, zip_only = FALSE) ## S4 method for signature 'AssessmentTest' createQtiTest(object, dir = getwd(), verification = FALSE, zip_only = FALSE) ## S4 method for signature 'character' createQtiTest(object, dir = getwd())createQtiTest(object, dir = NULL, verification = FALSE, zip_only = FALSE) ## S4 method for signature 'AssessmentItem' createQtiTest(object, dir = ".", verification = FALSE, zip_only = FALSE) ## S4 method for signature 'AssessmentTest' createQtiTest(object, dir = getwd(), verification = FALSE, zip_only = FALSE) ## S4 method for signature 'character' createQtiTest(object, dir = getwd())
object |
An instance of the AssessmentTest, AssessmentTestOpal or AssessmentItem S4 object. |
dir |
A character value, optional; a folder to store xml file; working directory is used by default. |
verification |
A boolean value, optional; checks the validity of XML
files. Default is |
zip_only |
A boolean value, optional; if |
A path to zip and xml files.
essay <- new("Essay", prompt = "Test task", title = "Essay", identifier = "q1") sc <- new("SingleChoice", prompt = "Test task", title = "SingleChoice", choices = c("A", "B", "C"), identifier = "q2") exam_section <- new("AssessmentSection", identifier = "sec_id", title = "section", assessment_item = list(essay, sc)) exam <- new("AssessmentTestOpal", identifier = "id_test", title = "some title", section = list(exam_section)) ## Not run: # creates folder with zip (side effect) createQtiTest(exam, "exam_folder", "TRUE") ## End(Not run)essay <- new("Essay", prompt = "Test task", title = "Essay", identifier = "q1") sc <- new("SingleChoice", prompt = "Test task", title = "SingleChoice", choices = c("A", "B", "C"), identifier = "q2") exam_section <- new("AssessmentSection", identifier = "sec_id", title = "section", assessment_item = list(essay, sc)) exam <- new("AssessmentTestOpal", identifier = "id_test", title = "some title", section = list(exam_section)) ## Not run: # creates folder with zip (side effect) createQtiTest(exam, "exam_folder", "TRUE") ## End(Not run)
Generic function for creating responseDeclaration element for XML document of specification the question following the QTI schema v2.1
createResponseDeclaration(object) ## S4 method for signature 'AssessmentItem' createResponseDeclaration(object) ## S4 method for signature 'MatchTable' createResponseDeclaration(object) ## S4 method for signature 'Entry' createResponseDeclaration(object) ## S4 method for signature 'Essay' createResponseDeclaration(object) ## S4 method for signature 'InlineChoice' createResponseDeclaration(object) ## S4 method for signature 'MultipleChoice' createResponseDeclaration(object) ## S4 method for signature 'MultipleChoiceTable' createResponseDeclaration(object) ## S4 method for signature 'NumericGap' createResponseDeclaration(object) ## S4 method for signature 'Ordering' createResponseDeclaration(object) ## S4 method for signature 'SingleChoice' createResponseDeclaration(object) ## S4 method for signature 'TextGap' createResponseDeclaration(object)createResponseDeclaration(object) ## S4 method for signature 'AssessmentItem' createResponseDeclaration(object) ## S4 method for signature 'MatchTable' createResponseDeclaration(object) ## S4 method for signature 'Entry' createResponseDeclaration(object) ## S4 method for signature 'Essay' createResponseDeclaration(object) ## S4 method for signature 'InlineChoice' createResponseDeclaration(object) ## S4 method for signature 'MultipleChoice' createResponseDeclaration(object) ## S4 method for signature 'MultipleChoiceTable' createResponseDeclaration(object) ## S4 method for signature 'NumericGap' createResponseDeclaration(object) ## S4 method for signature 'Ordering' createResponseDeclaration(object) ## S4 method for signature 'SingleChoice' createResponseDeclaration(object) ## S4 method for signature 'TextGap' createResponseDeclaration(object)
object |
an instance of the S4 object (SingleChoice, MultipleChoice, Entry, Ordering, OneInRowTable, OneInColTable, MultipleChoiceTable, DirectedPair, TextGap, NumericGap, InlineChoice) |
Generic function for creating responseProcessing element for XML document of specification the question following the QTI schema v2.1
createResponseProcessing(object) ## S4 method for signature 'AssessmentItem' createResponseProcessing(object) ## S4 method for signature 'Entry' createResponseProcessing(object) ## S4 method for signature 'Essay' createResponseProcessing(object) ## S4 method for signature 'Gap' createResponseProcessing(object) ## S4 method for signature 'MultipleChoice' createResponseProcessing(object) ## S4 method for signature 'NumericGap' createResponseProcessing(object) ## S4 method for signature 'Ordering' createResponseProcessing(object) ## S4 method for signature 'SingleChoice' createResponseProcessing(object) ## S4 method for signature 'TextGapOpal' createResponseProcessing(object)createResponseProcessing(object) ## S4 method for signature 'AssessmentItem' createResponseProcessing(object) ## S4 method for signature 'Entry' createResponseProcessing(object) ## S4 method for signature 'Essay' createResponseProcessing(object) ## S4 method for signature 'Gap' createResponseProcessing(object) ## S4 method for signature 'MultipleChoice' createResponseProcessing(object) ## S4 method for signature 'NumericGap' createResponseProcessing(object) ## S4 method for signature 'Ordering' createResponseProcessing(object) ## S4 method for signature 'SingleChoice' createResponseProcessing(object) ## S4 method for signature 'TextGapOpal' createResponseProcessing(object)
object |
an instance of the S4 object (SingleChoice, MultipleChoice, Essay, Entry, Ordering, OneInRowTable, OneInColTable, MultipleChoiceTable, DirectedPair, TextGap, NumericGap, InlineChoice) |
Generic function for creating a set of html elements to display question for XML document of specification the question following the QTI schema v2.1
createText(object) ## S4 method for signature 'Gap' createText(object) ## S4 method for signature 'InlineChoice' createText(object) ## S4 method for signature 'character' createText(object)createText(object) ## S4 method for signature 'Gap' createText(object) ## S4 method for signature 'InlineChoice' createText(object) ## S4 method for signature 'character' createText(object)
object |
an instance of the S4 object (Gap, InlineChoice, character) |
Generic function for creating zip archive with set of XML documents of specification the test following the QTI schema v2.1
createZip(object, input, output, file_name, zip_only) ## S4 method for signature 'AssessmentTest' createZip(object, input, output, file_name, zip_only) ## S4 method for signature 'AssessmentTestOpal' createZip(object, input, output, file_name, zip_only)createZip(object, input, output, file_name, zip_only) ## S4 method for signature 'AssessmentTest' createZip(object, input, output, file_name, zip_only) ## S4 method for signature 'AssessmentTestOpal' createZip(object, input, output, file_name, zip_only)
object |
an instance of the S4 object AssessmentTest or AssessmentTestOpal |
input |
string, optional; a source folder with xml files |
output |
string, optional; a folder to store zip and xml files; working directory by default |
file_name |
string, optional; file name of zip archive |
zip_only |
boolean, optional; if TRUE, returns only the zip file. If FALSE, returns the zip, XML, and download files. |
Create object DirectedPair
directedPair( identifier = generate_id(), title = identifier, content = list(), prompt = "", points = 1, rows, rows_identifiers, cols, cols_identifiers, answers_identifiers, answers_scores = NA_real_, shuffle = TRUE, shuffle_rows = TRUE, shuffle_cols = TRUE, feedback = list(), orientation = "vertical", calculator = NA_character_, files = NA_character_ )directedPair( identifier = generate_id(), title = identifier, content = list(), prompt = "", points = 1, rows, rows_identifiers, cols, cols_identifiers, answers_identifiers, answers_scores = NA_real_, shuffle = TRUE, shuffle_rows = TRUE, shuffle_cols = TRUE, feedback = list(), orientation = "vertical", calculator = NA_character_, files = NA_character_ )
identifier |
A character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits. |
title |
A character representing the title of the XML file associated with the task. By default, it takes the value of the identifier. |
content |
A character string or a list of character strings to form the text of the question, which may include HTML tags. |
prompt |
An optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "". |
points |
A numeric value, optional, representing the number of points for the entire task. If not provided, the default is calculated as 0.5 points per pair. |
rows |
A character vector specifying answer options as the first elements in couples. |
rows_identifiers |
A character vector, optional, specifies identifiers of the first elements in couples. |
cols |
A character vector specifying answer options as the second elements in couples. |
cols_identifiers |
A character vector, optional, specifies identifiers of the second elements in couples. |
answers_identifiers |
A character vector specifying couples of identifiers that combine the correct answers. |
answers_scores |
A numeric vector, optional, where each number determines the number of points awarded to a candidate if they select the corresponding answer. If not assigned, the individual values for correct answers are calculated from the task points and the number of correct options. |
shuffle |
A boolean value, optional, determining whether to randomize the
order in which the choices are initially presented to the candidate. Default
is |
shuffle_rows |
A boolean value, optional, determining whether to
randomize the order of the choices only for the first elements of the answer
tuples. Default is |
shuffle_cols |
A boolean value, optional, determining whether to
randomize the order of the choices only for the second elements of the
answer tuples. Default is |
feedback |
A list containing feedback message-object ModalFeedback for candidates. |
orientation |
A character, optional, determining whether to place answers in vertical or horizontal mode. Possible values:
|
calculator |
A character, optional, determining whether to show a calculator to the candidate. Possible values:
|
files |
A character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam. |
An object of class DirectedPair
dp_min <- directedPair(content = "<p>\"Directed pairs\" task</p>", rows = c("alfa", "beta", "gamma"), rows_identifiers = c("a", "b", "g"), cols = c("A", "B", "G;"), cols_identifiers = c("as", "bs", "gs"), answers_identifiers = c("a as", "b bs", 'g gs')) dp <- directedPair(identifier = "id_task_1234", title = "Directed Pair Task", content = "<p>\"Directed pairs\" task</p>", prompt = "Plain text, can be used instead of the content", rows = c("alfa", "beta", "gamma"), rows_identifiers = c("a", "b", "g"), cols = c("A", "B", "G"), cols_identifiers = c("as", "bs", "gs"), answers_identifiers = c("a as", "b bs", "g gs"), answers_scores = c(1, 0.5, 0.1), shuffle_rows = FALSE, shuffle_cols = TRUE, orientation = "horizontal")dp_min <- directedPair(content = "<p>\"Directed pairs\" task</p>", rows = c("alfa", "beta", "gamma"), rows_identifiers = c("a", "b", "g"), cols = c("A", "B", "G;"), cols_identifiers = c("as", "bs", "gs"), answers_identifiers = c("a as", "b bs", 'g gs')) dp <- directedPair(identifier = "id_task_1234", title = "Directed Pair Task", content = "<p>\"Directed pairs\" task</p>", prompt = "Plain text, can be used instead of the content", rows = c("alfa", "beta", "gamma"), rows_identifiers = c("a", "b", "g"), cols = c("A", "B", "G"), cols_identifiers = c("as", "bs", "gs"), answers_identifiers = c("a as", "b bs", "g gs"), answers_scores = c(1, 0.5, 0.1), shuffle_rows = FALSE, shuffle_cols = TRUE, orientation = "horizontal")
Class DirectedPair is responsible for creating assessment tasks according
to the QTI 2.1 standard, where a candidate has to make binary associations
between answer options.
identifierA character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits.
titleA character representing the title of the XML file associated with the task. By default, it takes the value of the identifier.
contentA list of character content to form the text of the question, which can include HTML tags. For tasks of the Entry type, it must also contain at least one instance of Gap objects, such as TextGap, TextGapOpal, NumericGap, or InlineChoice.
promptAn optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "".
pointsA numeric value, optional, representing the number of points for the entire task. Default is 1, but pay attention:
For tasks of the Entry type, it is calculated as the sum of the gap points by default.
For tasks of the DirectedPair, the default is calculated as 0.5 points per pair.
For tasks of the MatchTable type, it can also be calculated as the sum of points for individual answers, when provided.
For tasks of the MultipleChoice type, points is numeric vector and
required. Each number in this vector determines the number of points that
will be awarded to a candidate if they select the corresponding answer. The
order of the scores must match the order of the choices. It is possible
to assign negative values to incorrect answers. All answers with a
positive score are considered correct.
feedbackA list containing feedback messages for candidates. Each element of the list should be an instance of either ModalFeedback, CorrectFeedback, or WrongFeedback class.
calculatorA character, optional, determining whether to show a calculator to the candidate. Possible values:
"simple"
"scientific"
filesA character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam.
metadataAn object of class QtiMetadata that holds metadata information about the task.
stylesheet_pathOptional character vector of local CSS file paths. Stylesheets are linked from the item and included in QTI exports. In Rmd YAML, relative paths are resolved against the Rmd file's directory.
cssOptional single character string of CSS text, linked after any
files in stylesheet_path. In Rmd YAML, use a literal block (css: |).
CSS assets referenced by url() or @import are not bundled automatically.
rowsA character vector specifying answer options as row names in the table or the first elements in couples in DirectedPair.
rows_identifiersA character vector, optional, specifying identifiers for answer options defined in rows of the table or identifiers of the first elements in couples in DirectedPair.
colsA character vector specifying answer options as column headers in the table or the second elements in couples in DirectedPair.
cols_identifiersA character vector, optional, specifying identifiers for answer options defined in columns of the table or identifiers of the second elements in couples in DirectedPair.
answers_identifiersA character vector specifying couples of identifiers that combine the correct answers.
answers_scoresA numeric vector, optional, where each number determines the number of points awarded to a candidate if they select the corresponding answer. If not assigned, the individual values for correct answers are calculated from the task points and the number of correct options.
shuffleA boolean value, optional, determining whether to randomize the
order in which the choices are initially presented to the candidate.
Default is TRUE.
shuffle_rowsA boolean value, optional, determining whether to
randomize the order of the choices only in rows. Default is TRUE.
shuffle_colsA boolean value, optional, determining whether to
randomize the order of the choices only in columns. Default is TRUE.
orientationA character, optional, determining whether to place answers in vertical or horizontal mode. Possible values:
"vertical" - Default.
"horizontal"
dp <- new("DirectedPair", identifier = "id_task_1234", title = "Directed pair", content = list("<p>\"Directed pairs\" task</p>"), points = 5, rows = c("row1", "row2", "row3"), rows_identifiers = c("a", "b", "c"), cols = c("alfa", "beta", "gamma"), cols_identifiers = c("k", "l", "m"), answers_identifiers = c("a k", "b l", 'c m'), shuffle = TRUE, orientation = "vertical")dp <- new("DirectedPair", identifier = "id_task_1234", title = "Directed pair", content = list("<p>\"Directed pairs\" task</p>"), points = 5, rows = c("row1", "row2", "row3"), rows_identifiers = c("a", "b", "c"), cols = c("alfa", "beta", "gamma"), cols_identifiers = c("k", "l", "m"), answers_identifiers = c("a k", "b l", 'c m'), shuffle = TRUE, orientation = "vertical")
Create YAML string for InlineChoice object (dropdown list)
dropdown( choices, solution_index = 1, points = 1, shuffle = TRUE, response_identifier = NULL )dropdown( choices, solution_index = 1, points = 1, shuffle = TRUE, response_identifier = NULL )
choices |
A numeric or character vector; contains the possible answers. If you use a named vector, the names will be used as identifiers. |
solution_index |
An integer value, optional; the number of right answer
in the |
points |
A numeric value, optional; the number of points for this gap.
Default is |
shuffle |
A boolean, optional; determines whether to randomize the order in
which the choices are initially presented to the candidate. Default is
|
response_identifier |
A character string, optional; an identifier for the answer. |
A character string mapped as YAML.
gap_text(), gap_numeric(), mdlist()
dropdown(c("Option A", "Option B"), response_identifier = "task_dd_list")dropdown(c("Option A", "Option B"), response_identifier = "task_dd_list")
Create object Entry
entry( identifier = generate_id(), title = identifier, content = list(), prompt = "", points = 1, feedback = list(), calculator = NA_character_, files = NA_character_ )entry( identifier = generate_id(), title = identifier, content = list(), prompt = "", points = 1, feedback = list(), calculator = NA_character_, files = NA_character_ )
identifier |
A character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits. |
title |
A character representing the title of the XML file associated with the task. By default, it takes the value of the identifier. |
content |
A list of character content to form the text of the question,
which can include HTML tags. For tasks of the Entry type, it must also
contain at least one instance of Gap objects, such as |
prompt |
An optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "". |
points |
A numeric value, it is calculated as the sum of the gap points by default. |
feedback |
A list containing feedback message-object ModalFeedback for candidates. |
calculator |
A character, optional, determining whether to show a calculator to the candidate. Possible values:
|
files |
A character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam. |
An object of class Entry
[textGap()][numericGap()][textGapOpal()]
gap_min <- entry(content = list("Question and Test Interoperability", textGap("QTI"))) gap <- entry(identifier = "id_task_1234", title = "Essay Task", content = list("Question and Test Interoperability:", textGap("QTI")), prompt = "Plain text, can be used instead of content", points = 2, feedback = list(new("ModalFeedback", content = list("Model answer"))), calculator = "scientific-calculator", files = "text_book.pdf")gap_min <- entry(content = list("Question and Test Interoperability", textGap("QTI"))) gap <- entry(identifier = "id_task_1234", title = "Essay Task", content = list("Question and Test Interoperability:", textGap("QTI")), prompt = "Plain text, can be used instead of content", points = 2, feedback = list(new("ModalFeedback", content = list("Model answer"))), calculator = "scientific-calculator", files = "text_book.pdf")
Class Entry is responsible for creating assessment tasks according to the
QTI 2.1 standard. These tasks include one or more instances of text input
fields (with numeric or text answers) or dropdown lists.
identifierA character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits.
titleA character representing the title of the XML file associated with the task. By default, it takes the value of the identifier.
contentA list of character content to form the text of the question, which can include HTML tags. For tasks of the Entry type, it must also contain at least one instance of Gap objects, such as TextGap, TextGapOpal, NumericGap, or InlineChoice.
promptAn optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "".
pointsA numeric value, optional, representing the number of points for the entire task. Default is 1, but pay attention:
For tasks of the Entry type, it is calculated as the sum of the gap points by default.
For tasks of the DirectedPair, the default is calculated as 0.5 points per pair.
For tasks of the MatchTable type, it can also be calculated as the sum of points for individual answers, when provided.
For tasks of the MultipleChoice type, points is numeric vector and
required. Each number in this vector determines the number of points that
will be awarded to a candidate if they select the corresponding answer. The
order of the scores must match the order of the choices. It is possible
to assign negative values to incorrect answers. All answers with a
positive score are considered correct.
feedbackA list containing feedback messages for candidates. Each element of the list should be an instance of either ModalFeedback, CorrectFeedback, or WrongFeedback class.
calculatorA character, optional, determining whether to show a calculator to the candidate. Possible values:
"simple"
"scientific"
filesA character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam.
metadataAn object of class QtiMetadata that holds metadata information about the task.
stylesheet_pathOptional character vector of local CSS file paths. Stylesheets are linked from the item and included in QTI exports. In Rmd YAML, relative paths are resolved against the Rmd file's directory.
cssOptional single character string of CSS text, linked after any
files in stylesheet_path. In Rmd YAML, use a literal block (css: |).
CSS assets referenced by url() or @import are not bundled automatically.
NumericGap, TextGap, TextGapOpal, InlineChoice
entry_gaps <- new("Entry", content = list("<p>In mathematics, the common logarithm is the logarithm with base", new("NumericGap", response_identifier = "numeric_1", solution = 10, placeholder = "it is a number"), ". It is also known as the decimal", new("TextGap", response_identifier = "text_1", solution = "logarithm", placeholder = "it is a text"), ".</p>"), title = "entry with number and text in answers", identifier = "entry_example") entry_dropdown <- new("Entry", content = list("<p>In mathematics, the common logarithm is the logarithm with base", new("InlineChoice", response_identifier = "numeric_1", choices = c("10", "7", "11")), ". It is also known as the decimal", new("InlineChoice", response_identifier = "text_1", choices = c("logarithm", "limit")), ".</p>"), title = "entry with dropdown lists for answers", identifier = "entry_example")entry_gaps <- new("Entry", content = list("<p>In mathematics, the common logarithm is the logarithm with base", new("NumericGap", response_identifier = "numeric_1", solution = 10, placeholder = "it is a number"), ". It is also known as the decimal", new("TextGap", response_identifier = "text_1", solution = "logarithm", placeholder = "it is a text"), ".</p>"), title = "entry with number and text in answers", identifier = "entry_example") entry_dropdown <- new("Entry", content = list("<p>In mathematics, the common logarithm is the logarithm with base", new("InlineChoice", response_identifier = "numeric_1", choices = c("10", "7", "11")), ". It is also known as the decimal", new("InlineChoice", response_identifier = "text_1", choices = c("logarithm", "limit")), ".</p>"), title = "entry with dropdown lists for answers", identifier = "entry_example")
Create object Essay
essay( identifier = generate_id(), title = identifier, content = list(), prompt = "", points = 1, feedback = list(), expected_length = length_expected(feedback), expected_lines = lines_expected(feedback), words_max = max_words(feedback), words_min = NA_integer_, data_allow_paste = TRUE, calculator = NA_character_, files = NA_character_ )essay( identifier = generate_id(), title = identifier, content = list(), prompt = "", points = 1, feedback = list(), expected_length = length_expected(feedback), expected_lines = lines_expected(feedback), words_max = max_words(feedback), words_min = NA_integer_, data_allow_paste = TRUE, calculator = NA_character_, files = NA_character_ )
identifier |
A character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits. |
title |
A character representing the title of the XML file associated with the task. By default, it takes the value of the identifier. |
content |
A character string or a list of character strings to form the text of the question, which may include HTML tags. |
prompt |
An optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "". |
points |
A numeric value, optional, representing the number of points for the entire task. Default is 1. |
feedback |
A list containing feedback message-object ModalFeedback for candidates. |
expected_length |
A numeric, optional. Responsible for setting the size
of the text input field in the content delivery engine. By default it will
be calculated according to model answer in the slot |
expected_lines |
A numeric, optional. Responsible for setting the number
of rows of the text input field in the content delivery engine. By default
it will be calculated according to model answer in the slot |
words_max |
A numeric, optional. Responsible for setting the maximum
number of words that a candidate can write in the text input field. By
default it will be calculated according to model answer in the slot
|
words_min |
A numeric, optional. Responsible for setting the minimum number of words that a candidate should write in the text input field. |
data_allow_paste |
A boolean, optional. Determines whether it is possible for a candidate to copy text into the text input field. Default is TRUE. Only works on OPAL and OpenOlat. |
calculator |
A character, optional, determining whether to show a calculator to the candidate. Possible values:
|
files |
A character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam. |
An object of class Essay
es_min <- essay(content = list("<h2>Open question</h2>", "Write your answer here")) es <- essay(identifier = "id_task_1234", title = "Essay Task", content = "<h2>Open question</h2> Write your answer here", prompt = "Plain text, can be used instead of content", points = 2, expected_length = 100, expected_lines = 5, words_max = 100, words_min = 1, data_allow_paste = TRUE, feedback = list(new("ModalFeedback", content = list("Model answer"))), calculator = "scientific-calculator", files = "text_book.pdf")es_min <- essay(content = list("<h2>Open question</h2>", "Write your answer here")) es <- essay(identifier = "id_task_1234", title = "Essay Task", content = "<h2>Open question</h2> Write your answer here", prompt = "Plain text, can be used instead of content", points = 2, expected_length = 100, expected_lines = 5, words_max = 100, words_min = 1, data_allow_paste = TRUE, feedback = list(new("ModalFeedback", content = list("Model answer"))), calculator = "scientific-calculator", files = "text_book.pdf")
Class Essay is responsible for creating essay type of assessment
task according to QTI 2.1.
identifierA character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits.
titleA character representing the title of the XML file associated with the task. By default, it takes the value of the identifier.
contentA list of character content to form the text of the question, which can include HTML tags. For tasks of the Entry type, it must also contain at least one instance of Gap objects, such as TextGap, TextGapOpal, NumericGap, or InlineChoice.
promptAn optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "".
pointsA numeric value, optional, representing the number of points for the entire task. Default is 1, but pay attention:
For tasks of the Entry type, it is calculated as the sum of the gap points by default.
For tasks of the DirectedPair, the default is calculated as 0.5 points per pair.
For tasks of the MatchTable type, it can also be calculated as the sum of points for individual answers, when provided.
For tasks of the MultipleChoice type, points is numeric vector and
required. Each number in this vector determines the number of points that
will be awarded to a candidate if they select the corresponding answer. The
order of the scores must match the order of the choices. It is possible
to assign negative values to incorrect answers. All answers with a
positive score are considered correct.
feedbackA list containing feedback messages for candidates. Each element of the list should be an instance of either ModalFeedback, CorrectFeedback, or WrongFeedback class.
calculatorA character, optional, determining whether to show a calculator to the candidate. Possible values:
"simple"
"scientific"
filesA character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam.
metadataAn object of class QtiMetadata that holds metadata information about the task.
stylesheet_pathOptional character vector of local CSS file paths. Stylesheets are linked from the item and included in QTI exports. In Rmd YAML, relative paths are resolved against the Rmd file's directory.
cssOptional single character string of CSS text, linked after any
files in stylesheet_path. In Rmd YAML, use a literal block (css: |).
CSS assets referenced by url() or @import are not bundled automatically.
expected_lengthA numeric, optional. Responsible for setting the size of the text input field in the content delivery engine.
expected_linesA numeric, optional. Responsible for setting the number of rows of the text input field in the content delivery engine.
words_maxA numeric, optional. Responsible for setting the maximum number of words that a candidate can write in the text input field.
words_minA numeric, optional. Responsible for setting the minimum number of words that a candidate should write in the text input field.
data_allow_pasteA logical, optional. Determines whether it is possible
for a candidate to copy text into the text input field. Default is TRUE. Only works on OPAL and OpenOlat.
If 'ModalFeedback' is given, default values for slots related to the text input field are calculated automatically.
es <- new("Essay", identifier = "id_task_1234", title = "Essay Task", content = list("<p>Develop some idea and write it down in the text field</p>"), prompt = "Write your answer in text field", points = 1, feedback = list(), calculator = "scientific-calculator", files = "text_book.pdf", expected_length = 100, expected_lines = 5, words_max = 200, words_min = 10, data_allow_paste = FALSE)es <- new("Essay", identifier = "id_task_1234", title = "Essay Task", content = list("<p>Develop some idea and write it down in the text field</p>"), prompt = "Write your answer in text field", points = 1, feedback = list(), calculator = "scientific-calculator", files = "text_book.pdf", expected_length = 100, expected_lines = 5, words_max = 200, words_min = 10, data_allow_paste = FALSE)
Helper function for using tasks written in the exams Rmd format inside
rqti sections. The function converts the given Rmd file with
exams::exams2qti21() and returns the path to the generated XML file.
exams_task(path, title = NULL)exams_task(path, title = NULL)
path |
Character string. Path to an Rmd file written in the |
title |
Character string or |
This function is mainly useful when exams tasks need to be combined with
native rqti tasks in one section, for example:
section(exams_task(path_to_file, title = "Exams task")).
Character string. Path to the QTI 2.1 XML file generated by
exams::exams2qti21() in a temporary directory.
path <- system.file("exams", "example.Rmd", package = "rqti") section(exams_task(path, title = "Exams task"))path <- system.file("exams", "example.Rmd", package = "rqti") section(exams_task(path, title = "Exams task"))
The function extract_results() takes Opal zip archive "Export results" or
xml file and creates two kinds of data frames (according to parameter
'level'), see the 'Details' section.
extract_results(file, level = "task", hide_filename = TRUE) read_qti(file, level = "task", hide_filename = TRUE)extract_results(file, level = "task", hide_filename = TRUE) read_qti(file, level = "task", hide_filename = TRUE)
file |
A string with a path of the xml test result file. |
level |
A string with two possible values: task and item. |
hide_filename |
A boolean value, TRUE to hide original file names by default. |
A data frame with attributes of the candidates' outcomes and results. variables.
1.With option level = "task" data frame consists of columns:
'file' - name of the xml file with test results (to identify candidate)
'date' - date and time of test
'id_question' - question item identifier
'duration' - time in sec. what candidate spent on this item
'score_candidate' - points that were given to candidate after evaluation
'score_max' - max possible score for this question
'is_answer_given' - TRUE if candidate gave the answer on question, otherwise FALSE
'title' - the values of attribute 'title' of assessment items
'candidate_comment' - candidate's comment for the item (if available).
'scorer_comment' - scorer's comment for manually scored items (if available).
2.With option level = "item" data frame consists of columns:
'file' - name of the xml file with test results (to identify candidate)
'date' - date and time of test
'id_question' - question item identifier
'base_type' - type of answer (identifier, directedPair, string, float or integer)
'cardinalities' - defines whether this question is single, multiple or ordered -value
'qti_type' - specifies the type of the task
'id_answer' - identifier of each response variable
'expected_response' - values that considered as right responses for question
'candidate_response' - values that were given by candidate
'score_candidate' - - points that were given to candidate after evaluation
'score_max' - max possible score for this question item
'is_response_correct' - TRUE if candidate gave the right response, otherwise FALSE
'title' - the values of attribute 'title' of assessment items
'candidate_comment' - candidate's comment for the item (if available).
'scorer_comment' - scorer's comment for manually scored items (if available).
file <- system.file("test_results.zip", package = "rqti") df <- extract_results(file, level = "item")file <- system.file("test_results.zip", package = "rqti") df <- extract_results(file, level = "item")
Create YAML string for NumericGap object
gap_numeric( solution, tolerance = 0, tolerance_type = "absolute", points = 1, response_identifier = NULL, include_lower_bound = TRUE, include_upper_bound = TRUE, expected_length = size_gap(solution), placeholder = NULL )gap_numeric( solution, tolerance = 0, tolerance_type = "absolute", points = 1, response_identifier = NULL, include_lower_bound = TRUE, include_upper_bound = TRUE, expected_length = size_gap(solution), placeholder = NULL )
solution |
A numeric value; contains the correct answer for this numeric entry. |
tolerance |
A numeric value, optional; specifies the upper and lower boundaries of the tolerance range for the candidate's answer. Default is 0. |
tolerance_type |
A character string, optional; specifies tolerance mode; possible values:"exact", "absolute" (by default), "relative". |
points |
A numeric value, optional; the number of points for this gap. Default is 1. |
response_identifier |
A character string, optional; an identifier for the answer. |
include_lower_bound |
A boolean, optional; specifies whether the lower bound is included in the tolerance range. |
include_upper_bound |
A boolean, optional; specifies whether the upper bound is included in the tolerance range. |
expected_length |
An integer value, optional; sets the size of the text input field in the content delivery engine. |
placeholder |
A character string, optional; places helpful text in the text input field in the content delivery engine. |
A character string mapped as YAML.
gap_text(), dropdown(), mdlist()
gap_numeric(5.0, tolerance = 10, tolerance_type = "relative")gap_numeric(5.0, tolerance = 10, tolerance_type = "relative")
Create YAML string for TextGap object
gap_text( solution, tolerance = NULL, case_sensitive = FALSE, points = 1, response_identifier = NULL, expected_length = size_gap(solution), placeholder = NULL )gap_text( solution, tolerance = NULL, case_sensitive = FALSE, points = 1, response_identifier = NULL, expected_length = size_gap(solution), placeholder = NULL )
solution |
A character vector containing values considered as correct answers. |
tolerance |
An integer value, optional; defines the number of characters to tolerate spelling mistakes in evaluating candidate answers. |
case_sensitive |
A boolean, optional; determines whether the evaluation
of the correct answer is case sensitive. Default is |
points |
A numeric value, optional; the number of points for this gap. Default is 1. |
response_identifier |
A character string (optional) representing an identifier for the answer. |
expected_length |
An integer value, optional; sets the size of the text input field in the content delivery engine. |
placeholder |
A character string, optional; places helpful text in the text input field in the content delivery engine. |
A character string mapped as YAML.
gap_numeric(), dropdown(), mdlist()
gap_text(c("Solution", "Solutions"), tolerance = 2)gap_text(c("Solution", "Solutions"), tolerance = 2)
Abstract class Gap is not meant to be instantiated directly; instead, it
serves as a base for derived classes such as NumericGap, TextGap,
TextGapOpal and InlineChoice.
response_identifierA character value representing an identifier for the answer. By default, it is generated as 'id_gap_dddd', where dddd represents random digits.
pointsA numeric value, optional, representing the number of points for
this gap. Default is 1.
placeholderA character value, optional, used to place helpful text in the text input field in the content delivery engine.
expected_lengthA numeric value, optional, used to set the size of the text input field in the content delivery engine.
NumericGap, TextGap, TextGapOpal and InlineChoice.
A helper function that returns a named numeric vector representing a common German grading scheme. The names correspond to grades and the values define the minimum proportion of points required to achieve the respective grade.
german_grading()german_grading()
A named numeric vector with grades as names and minimum score proportions as values.
german_grading()german_grading()
Generic function for
getAssessmentItems(object) ## S4 method for signature 'AssessmentItem' getAssessmentItems(object) ## S4 method for signature 'AssessmentSection' getAssessmentItems(object) ## S4 method for signature 'character' getAssessmentItems(object)getAssessmentItems(object) ## S4 method for signature 'AssessmentItem' getAssessmentItems(object) ## S4 method for signature 'AssessmentSection' getAssessmentItems(object) ## S4 method for signature 'character' getAssessmentItems(object)
object |
an instance of the S4 object (AssessmentSection, AssessmentItem) |
Get value of the slot 'calculator'
getCalculator(object) ## S4 method for signature 'AssessmentItem' getCalculator(object) ## S4 method for signature 'AssessmentSection' getCalculator(object) ## S4 method for signature 'character' getCalculator(object)getCalculator(object) ## S4 method for signature 'AssessmentItem' getCalculator(object) ## S4 method for signature 'AssessmentSection' getCalculator(object) ## S4 method for signature 'character' getCalculator(object)
object |
an instance of the S4 object (SingleChoice, MultipleChoice, Essay, Entry, Ordering, OneInRowTable, OneInColTable, MultipleChoiceTable, DirectedPair, TextGap, NumericGap, InlineChoice) |
Get list of contributors values
getContributors(object) ## S4 method for signature 'AssessmentItem' getContributors(object) ## S4 method for signature 'AssessmentSection' getContributors(object) ## S4 method for signature 'character' getContributors(object)getContributors(object) ## S4 method for signature 'AssessmentItem' getContributors(object) ## S4 method for signature 'AssessmentSection' getContributors(object) ## S4 method for signature 'character' getContributors(object)
object |
an instance of the S4 object (SingleChoice, MultipleChoice, Essay, Entry, Ordering, OneInRowTable, OneInColTable, MultipleChoiceTable, DirectedPair, TextGap, NumericGap, InlineChoice) |
This method retrieves current assessment data for a course element on a Learning Management System (LMS), including score, maximum score, passed status, and attempts. If no LMS connection object is provided, it attempts to guess the connection using default settings (e.g., environment variables). If the connection cannot be established, an error is thrown.
This method retrieves current assessment data for a course element on LMS
Opal by course id and course element id. It returns user metadata together
with score, maximum score, passed status, and attempts. If user_id is
supplied, the query is restricted to that user login name or email address.
getCourseAssessment(object, course_id, node_id, user_id = NULL, ...) ## S4 method for signature 'missing' getCourseAssessment(object, course_id, node_id, user_id = NULL, ...) ## S4 method for signature 'Opal' getCourseAssessment(object, course_id, node_id, user_id = NULL)getCourseAssessment(object, course_id, node_id, user_id = NULL, ...) ## S4 method for signature 'missing' getCourseAssessment(object, course_id, node_id, user_id = NULL, ...) ## S4 method for signature 'Opal' getCourseAssessment(object, course_id, node_id, user_id = NULL)
object |
An S4 object of class Opal that represents a connection to the LMS. |
course_id |
A character vector of length one specifying the course context ID. |
node_id |
A character vector of length one specifying the course element ID. |
user_id |
A character vector of length one specifying the user login name
or email address. If |
... |
Additional arguments to be passed to the method, if applicable. |
A data frame with assessment scores.
A data frame with assessment scores. Each row represents a user and contains identity id, user id, user name/email, score, maximum score, passed status, and attempts.
assessment <- getCourseAssessment("89068111333293", "1617337826161777006") assessment <- getCourseAssessment("89068111333293", "1617337826161777006")assessment <- getCourseAssessment("89068111333293", "1617337826161777006") assessment <- getCourseAssessment("89068111333293", "1617337826161777006")
This method gets elements of the user's course by its courseId on Learning Management System (LMS). If no LMS connection object is provided, it attempts to guess the connection using default settings (e.g., environment variables). If the connection cannot be established, an error is thrown.
getCourseElements(object, course_id) ## S4 method for signature 'missing' getCourseElements(object, course_id) ## S4 method for signature 'Opal' getCourseElements(object, course_id)getCourseElements(object, course_id) ## S4 method for signature 'missing' getCourseElements(object, course_id) ## S4 method for signature 'Opal' getCourseElements(object, course_id)
object |
An S4 object of class Opal that represents a connection to the LMS. |
course_id |
A length one character vector with course id. |
A data frame with the elements of the course.
A data frame with the data of the elements of the course (fields: nodeId, shortTitle, shortName, longTitle) on LMS Opal.
This method retrieves groups from a course on the Learning Management System (LMS) by its course id. It returns a data frame with all accessible attributes of the groups. If no LMS connection object is provided, it attempts to guess the connection using default settings (e.g., environment variables). If the connection cannot be established, an error is thrown.
This method retrieves groups from a course on LMS Opal by its course id. The groups are returned as a data frame with all accessible attributes, such as group id, name, description, participant limits, and group settings. If no Opal connection object is provided, it attempts to guess the connection using default settings (e.g., environment variables). If the connection cannot be established, an error is thrown.
getCourseGroups(object, course_id) ## S4 method for signature 'missing' getCourseGroups(object, course_id) ## S4 method for signature 'Opal' getCourseGroups(object, course_id)getCourseGroups(object, course_id) ## S4 method for signature 'missing' getCourseGroups(object, course_id) ## S4 method for signature 'Opal' getCourseGroups(object, course_id)
object |
An S4 object of class Opal that represents a connection to the LMS. |
course_id |
A character vector of length one specifying the course resource ID. Note that this is not the course ID shown in the URL, but a longer identifier available via the "Show more information" option within the course. |
A data frame with all accessible attributes of the course groups.
A data frame with course groups and their attributes.
groups <- getCourseGroups("89068111333293") groups <- getCourseGroups("89068111333293")groups <- getCourseGroups("89068111333293") groups <- getCourseGroups("89068111333293")
This method retrieves zip with course results by its resource id and node id on Learning Management System (LMS). If no LMS connection object is provided, it attempts to guess the connection using default settings (e.g., environment variables). If the connection cannot be established, an error is thrown.
getCourseResult(object, resource_id, node_id, path_outcome = ".", ...) ## S4 method for signature 'missing' getCourseResult(object, resource_id, node_id, path_outcome = ".", ...) ## S4 method for signature 'Opal' getCourseResult( object, resource_id, node_id, path_outcome = ".", rename = TRUE )getCourseResult(object, resource_id, node_id, path_outcome = ".", ...) ## S4 method for signature 'missing' getCourseResult(object, resource_id, node_id, path_outcome = ".", ...) ## S4 method for signature 'Opal' getCourseResult( object, resource_id, node_id, path_outcome = ".", rename = TRUE )
object |
An S4 object of class Opal that represents a connection to the LMS. |
resource_id |
A length one character vector with resource id. |
node_id |
A length one character vector with node id (test). |
path_outcome |
A length one character vector with path, where the zip should be stored. Default is working directory. |
... |
Additional arguments to be passed to the method, if applicable. |
rename |
A boolean value; optional; Set |
It downloads a zip and return a character string with path.
zip_file <- getCourseResult("89068111333293", "1617337826161777006")zip_file <- getCourseResult("89068111333293", "1617337826161777006")
Get file paths for attachment of test
getFiles(object) ## S4 method for signature 'AssessmentItem' getFiles(object) ## S4 method for signature 'AssessmentSection' getFiles(object) ## S4 method for signature 'character' getFiles(object)getFiles(object) ## S4 method for signature 'AssessmentItem' getFiles(object) ## S4 method for signature 'AssessmentSection' getFiles(object) ## S4 method for signature 'character' getFiles(object)
object |
an instance of the S4 object (SingleChoice, MultipleChoice, Essay, Entry, Ordering, OneInRowTable, OneInColTable, MultipleChoiceTable, DirectedPair, TextGap, NumericGap, InlineChoice) |
This method retrieves users from a group on the Learning Management System (LMS) by its group id. It returns a data frame with all accessible attributes of the group members. If no LMS connection object is provided, it attempts to guess the connection using default settings (e.g., environment variables). If the connection cannot be established, an error is thrown.
This method retrieves users from a group on LMS Opal by its group id. It returns a data frame with user attributes obtained from the LMS, including user id, login, first name, last name, email, and additional properties (e.g., status). If no Opal connection object is provided, it attempts to guess the connection using default settings (e.g., environment variables). If the connection cannot be established, an error is thrown.
getGroupUsers(object, group_id) ## S4 method for signature 'missing' getGroupUsers(object, group_id) ## S4 method for signature 'Opal' getGroupUsers(object, group_id)getGroupUsers(object, group_id) ## S4 method for signature 'missing' getGroupUsers(object, group_id) ## S4 method for signature 'Opal' getGroupUsers(object, group_id)
object |
An S4 object of class Opal that represents a connection to the LMS. |
group_id |
A character vector specifying the group id. |
A data frame with all accessible attributes of the group members.
A data frame with group users and their attributes. Each row represents a user and may include the following columns:
Unique user id.
User login name.
User first name.
User last name.
User email address.
User status (e.g., STATUS_ACTIVE).
groups <- getGroupUsers("89068111333293") users <- getGroupUsers("89068111333293")groups <- getGroupUsers("89068111333293") users <- getGroupUsers("89068111333293")
Get identifier
getIdentifier(object) ## S4 method for signature 'AssessmentItem' getIdentifier(object) ## S4 method for signature 'AssessmentSection' getIdentifier(object) ## S4 method for signature 'Gap' getIdentifier(object) ## S4 method for signature 'character' getIdentifier(object)getIdentifier(object) ## S4 method for signature 'AssessmentItem' getIdentifier(object) ## S4 method for signature 'AssessmentSection' getIdentifier(object) ## S4 method for signature 'Gap' getIdentifier(object) ## S4 method for signature 'character' getIdentifier(object)
object |
an instance of the S4 object (SingleChoice, MultipleChoice, Essay, Entry, Ordering, OneInRowTable, OneInColTable, MultipleChoiceTable, DirectedPair, TextGap, NumericGap, InlineChoice) |
This method retrieves data about all resources associated with the current user on the Learning Management System (LMS). If no LMS connection object is provided, it attempts to guess the connection using default settings (e.g., environment variables). If the connection cannot be established, an error is thrown.
getLMSResources(object, ...) ## S4 method for signature 'missing' getLMSResources(object) ## S4 method for signature 'Opal' getLMSResources(object)getLMSResources(object, ...) ## S4 method for signature 'missing' getLMSResources(object) ## S4 method for signature 'Opal' getLMSResources(object)
object |
An S4 object of class Opal that represents a connection to the LMS. |
... |
Additional arguments to be passed to the method, if applicable. |
A data frame with attributes of the user's resources.
This method retrieves data about a user's resource by its name on Learning Management System (LMS). If no LMS connection object is provided, it attempts to guess the connection using default settings (e.g., environment variables). If the connection cannot be established, an error is thrown.
getLMSResourcesByName(object, ...) ## S4 method for signature 'missing' getLMSResourcesByName(object, display_name, rtype = NULL) ## S4 method for signature 'Opal' getLMSResourcesByName(object, display_name, rtype = NULL)getLMSResourcesByName(object, ...) ## S4 method for signature 'missing' getLMSResourcesByName(object, display_name, rtype = NULL) ## S4 method for signature 'Opal' getLMSResourcesByName(object, display_name, rtype = NULL)
object |
An S4 object of class Opal that represents a connection to the LMS. |
... |
Additional arguments to be passed to the method, if applicable. |
display_name |
A string value with the resource name. |
rtype |
A string value with the type of resource. Possible values: "FileResource.TEST", "FileResource.QUESTION", or "FileResource.SURVEY". |
A data frame with attributes of the user's resources.
df <- getLMSResourcesByName("task_name")df <- getLMSResourcesByName("task_name")
This method creates an URL for user's resource by its name on Learning Management System (LMS). If no LMS connection object is provided, it attempts to guess the connection using default settings (e.g., environment variables). If the connection cannot be established, an error is thrown.
getLMSResourceURL(object, display_name) ## S4 method for signature 'missing' getLMSResourceURL(object, display_name) ## S4 method for signature 'Opal' getLMSResourceURL(object, display_name)getLMSResourceURL(object, display_name) ## S4 method for signature 'missing' getLMSResourceURL(object, display_name) ## S4 method for signature 'Opal' getLMSResourceURL(object, display_name)
object |
An S4 object of class Opal that represents a connection to the LMS. |
display_name |
A length-one character vector naming the file in OPAL; it takes file name without extension by default; optional. |
A string value of URL.
Get object
getObject(object) ## S4 method for signature 'AssessmentItem' getObject(object) ## S4 method for signature 'AssessmentSection' getObject(object) ## S4 method for signature 'character' getObject(object)getObject(object) ## S4 method for signature 'AssessmentItem' getObject(object) ## S4 method for signature 'AssessmentSection' getObject(object) ## S4 method for signature 'character' getObject(object)
object |
an instance of the S4 object (SingleChoice, MultipleChoice, Essay, Entry, Ordering, OneInRowTable, OneInColTable, MultipleChoiceTable, DirectedPair, TextGap, NumericGap, InlineChoice) |
Get points from AssessmentItem object
getPoints(object) ## S4 method for signature 'AssessmentItem' getPoints(object) ## S4 method for signature 'AssessmentSection' getPoints(object) ## S4 method for signature 'MultipleChoice' getPoints(object) ## S4 method for signature 'SingleChoice' getPoints(object) ## S4 method for signature 'character' getPoints(object)getPoints(object) ## S4 method for signature 'AssessmentItem' getPoints(object) ## S4 method for signature 'AssessmentSection' getPoints(object) ## S4 method for signature 'MultipleChoice' getPoints(object) ## S4 method for signature 'SingleChoice' getPoints(object) ## S4 method for signature 'character' getPoints(object)
object |
an instance of the S4 object (SingleChoice, MultipleChoice, Essay, Entry, Ordering, OneInRowTable, OneInColTable, MultipleChoiceTable, DirectedPair, TextGap, NumericGap, InlineChoice) |
Generic function to get and process a different types of question content (text with instances of gaps or dropdown lists) for XML document of specification the question following the QTI schema v2.1
getResponse(object) ## S4 method for signature 'InlineChoice' getResponse(object) ## S4 method for signature 'NumericGap' getResponse(object) ## S4 method for signature 'TextGap' getResponse(object) ## S4 method for signature 'character' getResponse(object)getResponse(object) ## S4 method for signature 'InlineChoice' getResponse(object) ## S4 method for signature 'NumericGap' getResponse(object) ## S4 method for signature 'TextGap' getResponse(object) ## S4 method for signature 'character' getResponse(object)
object |
an instance of the S4 object (NumericGap, TextGap, InlineChoice, character) |
Create object InlineChoice
inlineChoice( choices, solution_index = 1, response_identifier = generate_id(type = "gap"), choices_identifiers = paste0("Choice", LETTERS[seq(choices)]), points = 1, shuffle = TRUE, placeholder = "", expected_length = size_gap(choices) )inlineChoice( choices, solution_index = 1, response_identifier = generate_id(type = "gap"), choices_identifiers = paste0("Choice", LETTERS[seq(choices)]), points = 1, shuffle = TRUE, placeholder = "", expected_length = size_gap(choices) )
choices |
A character vector containing the answers shown in the dropdown list. |
solution_index |
A numeric value, optional, representing the index of the correct answer in the options vector. Default is 1. |
response_identifier |
A character value representing an identifier for the answer. By default, it is generated as 'id_gap_dddd', where dddd represents random digits. |
choices_identifiers |
A character vector, optional, containing a set of identifiers for answers. By default, identifiers are generated automatically according to the template "OptionD", where D is a letter representing the alphabetical order of the answer in the list. |
points |
A numeric value, optional, representing the number of points for this gap. Default is 1 |
shuffle |
A boolean value, optional, determining whether to randomize the
order in which the choices are initially presented to the candidate. Default
is |
placeholder |
A character value, optional, used to place helpful text in the text input field in the content delivery engine. Default is "". |
expected_length |
A numeric value, optional, used to set the size of the text input field in the content delivery engine. Default value is adjusted by the first choice size. |
An object of class InlineChoice
[entry()][numericGap()][textGap()][textGapOpal()]
dd_min <- inlineChoice(c("answer1", "answer2", "answer3")) dd <- inlineChoice(choices = c("answer1", "answer2", "answer3"), solution_index = 2, response_identifier = "id_gap_1234", choices_identifiers = c("a", "b", "c"), points = 2, shuffle = FALSE, placeholder = "answers", expected_length = 10)dd_min <- inlineChoice(c("answer1", "answer2", "answer3")) dd <- inlineChoice(choices = c("answer1", "answer2", "answer3"), solution_index = 2, response_identifier = "id_gap_1234", choices_identifiers = c("a", "b", "c"), points = 2, shuffle = FALSE, placeholder = "answers", expected_length = 10)
Class InlineChoice is responsible for creating instances of dropdown lists
as answer options in Entry type assessment tasks according to the QTI 2.1
standard.
response_identifierA character value representing an identifier for the answer. By default, it is generated as 'id_gap_dddd', where dddd represents random digits.
pointsA numeric value, optional, representing the number of points for
this gap. Default is 1.
placeholderA character value, optional, used to place helpful text in the text input field in the content delivery engine.
expected_lengthA numeric value, optional, used to set the size of the text input field in the content delivery engine.
choicesA character vector containing the answers shown in the dropdown list.
solution_indexA numeric value, optional, representing the index of the
correct answer in the options vector. Default is 1.
choices_identifiersA character vector, optional, containing a set of identifiers for answers. By default, identifiers are generated automatically according to the template "OptionD", where D is a letter representing the alphabetical order of the answer in the list.
shuffleA boolean value, optional, determining whether to randomize the
order in which the choices are initially presented to the candidate.
Default is TRUE.
Entry, NumericGap, TextGap, TextGapOpal
dd <- new("InlineChoice", response_identifier = "id_gap_1234", points = 1, choices = c("answer1", "answer2", "answer3"), solution_index = 1, choices_identifiers = c("OptionA", "OptionB", "OptionC"), shuffle = TRUE)dd <- new("InlineChoice", response_identifier = "id_gap_1234", points = 1, choices = c("answer1", "answer2", "answer3"), solution_index = 1, choices_identifiers = c("OptionA", "OptionB", "OptionC"), shuffle = TRUE)
This method checks whether a user is logged into an LMS (Learning Management System) by sending a request to the LMS server and evaluating the response.
This method checks whether a user is logged into an LMS Opal by sending a request to the LMS server and evaluating the response.
isUserLoggedIn(object) ## S4 method for signature 'Opal' isUserLoggedIn(object)isUserLoggedIn(object) ## S4 method for signature 'Opal' isUserLoggedIn(object)
object |
An S4 object of class Opal that represents a connection to the LMS. |
A logical value (TRUE if the user is logged in, FALSE otherwise).
A logical value (TRUE if the user is logged in, FALSE otherwise).
The LMS class is an abstract representation of a Learning Management System (LMS).
It provides a foundation for defining LMS-specific implementations.
nameA character string representing the name or identifier of the LMS.
api_userA character string containing the username for authentication.
endpointA character string specifying the LMS API endpoint. By default,
this value is retrieved from the environment variable RQTI_API_ENDPOINT.
To set this variable globally, use:
Sys.setenv(RQTI_API_ENDPOINT = 'your_endpoint'),
or add it to your .Renviron file for persistence across sessions.
credential_idA character string identifying the credential set in the
operating-system keyring. If omitted, rqti derives the credential service
from the endpoint and falls back to its original service name for backward
compatibility. RQTI_API_CREDENTIAL_ID or an explicit value can override
automatic endpoint-based naming.
sessionAn internal environment containing connection-specific session state, including the authentication token.
Abstract class MatchTable is not meant to be instantiated directly;
instead, it serves as a base for derived classes such as OneInRowTable,
OneInColTable, MultipleChoiceTable, and DirectedPair.
identifierA character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits.
titleA character representing the title of the XML file associated with the task. By default, it takes the value of the identifier.
contentA list of character content to form the text of the question, which can include HTML tags. For tasks of the Entry type, it must also contain at least one instance of Gap objects, such as TextGap, TextGapOpal, NumericGap, or InlineChoice.
promptAn optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "".
pointsA numeric value, optional, representing the number of points for the entire task. Default is 1, but pay attention:
For tasks of the Entry type, it is calculated as the sum of the gap points by default.
For tasks of the DirectedPair, the default is calculated as 0.5 points per pair.
For tasks of the MatchTable type, it can also be calculated as the sum of points for individual answers, when provided.
For tasks of the MultipleChoice type, points is numeric vector and
required. Each number in this vector determines the number of points that
will be awarded to a candidate if they select the corresponding answer. The
order of the scores must match the order of the choices. It is possible
to assign negative values to incorrect answers. All answers with a
positive score are considered correct.
feedbackA list containing feedback messages for candidates. Each element of the list should be an instance of either ModalFeedback, CorrectFeedback, or WrongFeedback class.
calculatorA character, optional, determining whether to show a calculator to the candidate. Possible values:
"simple"
"scientific"
filesA character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam.
metadataAn object of class QtiMetadata that holds metadata information about the task.
stylesheet_pathOptional character vector of local CSS file paths. Stylesheets are linked from the item and included in QTI exports. In Rmd YAML, relative paths are resolved against the Rmd file's directory.
cssOptional single character string of CSS text, linked after any
files in stylesheet_path. In Rmd YAML, use a literal block (css: |).
CSS assets referenced by url() or @import are not bundled automatically.
rowsA character vector specifying answer options as row names in the table or the first elements in couples in DirectedPair.
rows_identifiersA character vector, optional, specifying identifiers for answer options defined in rows of the table or identifiers of the first elements in couples in DirectedPair.
colsA character vector specifying answer options as column headers in the table or the second elements in couples in DirectedPair.
cols_identifiersA character vector, optional, specifying identifiers for answer options defined in columns of the table or identifiers of the second elements in couples in DirectedPair.
answers_identifiersA character vector specifying couples of identifiers that combine the correct answers.
answers_scoresA numeric vector, optional, where each number determines the number of points awarded to a candidate if they select the corresponding answer. If not assigned, the individual values for correct answers are calculated from the task points and the number of correct options.
shuffleA boolean value, optional, determining whether to randomize the
order in which the choices are initially presented to the candidate.
Default is TRUE.
shuffle_rowsA boolean value, optional, determining whether to
randomize the order of the choices only in rows. Default is TRUE.
shuffle_colsA boolean value, optional, determining whether to
randomize the order of the choices only in columns. Default is TRUE.
OneInRowTable, OneInColTable, MultipleChoiceTable, DirectedPair
Create a markdown list for answer options
mdlist(vect, solutions = NULL, gaps = NULL)mdlist(vect, solutions = NULL, gaps = NULL)
vect |
A string or numeric vector of answer options for single/multiple choice task. |
solutions |
An integer value, optional; indexes of right answer options
in |
gaps |
numeric or string vector, optional; provides primitive gap description if there is a need to build a list of gaps. |
A markdown list.
gap_text(), gap_numeric(), dropdown()
#list for multiple choice task mdlist(c("A", "B", "C"), c(2, 3)) # it returns: #- A #- *B* #- *C* #list of gaps mdlist(c("A", "B", "C"), c(2, 3), c(1, 2, 3)) # it returns: #- A <gap>1</gap> #- *B* <gap>2</gap> #- *C* <gap>3</gap>#list for multiple choice task mdlist(c("A", "B", "C"), c(2, 3)) # it returns: #- A #- *B* #- *C* #list of gaps mdlist(c("A", "B", "C"), c(2, 3), c(1, 2, 3)) # it returns: #- A <gap>1</gap> #- *B* <gap>2</gap> #- *C* <gap>3</gap>
Create object ModalFeedback
modalFeedback(content = list(), title = character(0), show = TRUE)modalFeedback(content = list(), title = character(0), show = TRUE)
content |
A character string or a list of character strings to form the text of the question, which may include HTML tags. |
title |
A character value, optional, representing the title of the modal feedback window. |
show |
A boolean value, optional, determining whether to show ( |
An object of class ModalFeedback
fb <- modalFeedback(content = "Model answer", title = "Feedback")fb <- modalFeedback(content = "Model answer", title = "Feedback")
Class ModalFeedback is responsible for delivering feedback
messages to the candidate, regardless of whether the answer was correct or
incorrect.
outcome_identifierA character representing the unique identifier of the outcome declaration variable that relates to feedback. Default is "FEEDBACKMODAL".
showA boolean value, optional, determining whether to show (TRUE) or
hide (FALSE) the modal feedback. Default is TRUE.
titleA character value, optional, representing the title of the modal feedback window.
contentA list of character content to form the text of the modal feedback, which can include HTML tags.
identifierA character value representing the identifier of the modal feedback item. Default is "modal_feedback".
fb <- new("ModalFeedback", title = "Possible solution", content = list("<b>Some explanation</b>"))fb <- new("ModalFeedback", title = "Possible solution", content = list("<b>Some explanation</b>"))
Create a scoring specification for multipleChoice() or a multiple-choice
Rmd item. These items permit several selected options. For one-answer items,
see single_choice_scoring(). Both this helper and the multiple-choice item
default to "standard": balanced partial credit equivalent to Youden's J
with a zero floor for the usual automatically balanced weights.
multiple_choice_scoring(method = "standard", ...)multiple_choice_scoring(method = "standard", ...)
method |
A multiple-choice method. See the table below. The default is
|
... |
Settings for the selected method. |
A named list for scoring_scheme in multipleChoice(). Passing it
to singleChoice() is an error. Plain YAML mappings are interpreted
using the item's type.
Positive entries in the item's points identify correct options, and their
sum is the maximum score P. C is the number of correct options and W the
number of incorrect options.
| Method | Rule |
standard |
Default balanced (Youden's J) weights and zero floor; explicit weights are preserved |
weights |
Preserve all supplied weights, including explicit zeros; use the chosen floor |
all_or_nothing |
Full credit only for selecting exactly the correct set |
plus_minus |
Each selected correct option adds P/C; each selected incorrect option subtracts P/C |
subset |
Selected correct options earn P/C each, only if no incorrect option is selected |
ripkey |
Selected correct options earn P/C each, unless more than C options are selected |
true_false |
Each correctly classified option earns P/(C+W), including unchecked incorrect options |
exams |
Use the selected R/exams weighting, partial-credit setting and score floor |
The five literature methods are described by Betts et al. Their raw scores
are scaled here to the item maximum P. Those five methods and exams use
the correct-option set and its total points, rather than the relative
magnitudes of positive option weights. standard and weights preserve
individual contributions, with the zero-weight handling described above.
balanced scoring and Youden's J: With C > 0 correct options, W > 0 incorrect options, equal correct-option weights, and automatically balanced incorrect-option penalties, the raw normalized score is Youden's J:
The awarded score is . Each selected correct option adds
P/C and each selected incorrect option subtracts P/W; unchecked options
contribute zero. This is the ordinary Rmd default when its correct options
share the points equally. The raw J has zero expectation under independent
random selection; flooring it at zero does not preserve that expectation.
standard also preserves explicit negative option weights. If the positive
or negative weights differ from those balanced contributions, the resulting
custom weighting is not necessarily Youden's J. standard is the method
identifier; Youden's J describes its ordinary balanced special case.
true_false treats an unchecked option as a false decision, so an empty
selection can earn P*W/(C+W). Checkboxes cannot distinguish a deliberate
nonselection from an omitted decision. An explicit true/false/omission
interaction is a different format. The other methods score an empty response
as zero unless otherwise configured. By default negative totals are floored
at zero; weights, plus_minus, all_or_nothing, and exams can allow
negative scores through their documented settings. Scores never exceed P.
scoring_scheme: method: exams partial: true negative: -0.25 rule: "false2"
Or use a preset string, for example scoring_scheme: plus_minus.
The YAML list is interpreted from type: mpc (or another supported
multiple-choice type alias); no function call is needed inside YAML.
Betts J, Muntean W, Kim D, Kao S (2022). Evaluating Different Scoring Methods for Multiple Response Items Providing Partial Credit. Educational and Psychological Measurement, 82(1), 151–176. doi:10.1177/0013164421994636.
multipleChoice(), single_choice_scoring()
multipleChoice(choices = c("A", "B", "C"), points = c(0.5, 0, 0.5), scoring_scheme = multiple_choice_scoring("plus_minus")) multipleChoice(choices = c("A", "B", "C"), points = c(0.5, 0, 0.5), scoring_scheme = multiple_choice_scoring("exams", rule = "none"))multipleChoice(choices = c("A", "B", "C"), points = c(0.5, 0, 0.5), scoring_scheme = multiple_choice_scoring("plus_minus")) multipleChoice(choices = c("A", "B", "C"), points = c(0.5, 0, 0.5), scoring_scheme = multiple_choice_scoring("exams", rule = "none"))
Create object MultipleChoice
multipleChoice( identifier = generate_id(), title = identifier, choices, choice_identifiers = paste0("Choice", LETTERS[seq(choices)]), content = list(), prompt = "", points = 1, feedback = list(), orientation = "vertical", shuffle = TRUE, calculator = NA_character_, files = NA_character_, scoring_scheme = "standard" )multipleChoice( identifier = generate_id(), title = identifier, choices, choice_identifiers = paste0("Choice", LETTERS[seq(choices)]), content = list(), prompt = "", points = 1, feedback = list(), orientation = "vertical", shuffle = TRUE, calculator = NA_character_, files = NA_character_, scoring_scheme = "standard" )
identifier |
A character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits. |
title |
A character representing the title of the XML file associated with the task. By default, it takes the value of the identifier. |
choices |
A character vector defining a set of answer options in the question. |
choice_identifiers |
A character vector, optional, containing a set of identifiers for answers. By default, identifiers are generated automatically according to the template "ChoiceD", where D is a letter representing the alphabetical order of the answer in the list. |
content |
A character string or a list of character strings to form the text of the question, which may include HTML tags. |
prompt |
An optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "". |
points |
A numeric vector, required. Each number in this vector determines the number of points that will be awarded to a candidate if they select the corresponding answer. The order of the scores must match the order of the choices. It is possible to assign negative values to incorrect answers. All answers with a positive score are considered correct. |
feedback |
A list containing feedback messages for candidates. Each element of the list should be an instance of either ModalFeedback, CorrectFeedback, or WrongFeedback class. |
orientation |
A character, determining whether to place answers in vertical or horizontal mode. Possible values:
|
shuffle |
A boolean value indicating whether to randomize the order in
which the choices are initially presented to the candidate. Default is
|
calculator |
A character, optional, determining whether to show a calculator to the candidate. Possible values:
|
files |
A character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam. |
scoring_scheme |
A method name or specification from |
An object of class MultipleChoice
mc_min <- multipleChoice(choices = c("option1", "option2", "option3"), points = c(0, 0.5, 0.5)) mc <- multipleChoice(identifier = "id_task_1234", title = "Multiple Choice Task", content = "<p>Pick up the right options</p>", prompt = "Plain text, can be used instead of content", points = c(0, 0.5, 0.5), feedback = list(new("WrongFeedback", content = list("Wrong answer"))), calculator = "scientific-calculator", files = "text_book.pdf", choices = c("option 1", "option 2", "option 3"), choice_identifiers = c("ChoiceA", "ChoiceB", "ChoiceC"), shuffle = TRUE, orientation = "vertical")mc_min <- multipleChoice(choices = c("option1", "option2", "option3"), points = c(0, 0.5, 0.5)) mc <- multipleChoice(identifier = "id_task_1234", title = "Multiple Choice Task", content = "<p>Pick up the right options</p>", prompt = "Plain text, can be used instead of content", points = c(0, 0.5, 0.5), feedback = list(new("WrongFeedback", content = list("Wrong answer"))), calculator = "scientific-calculator", files = "text_book.pdf", choices = c("option 1", "option 2", "option 3"), choice_identifiers = c("ChoiceA", "ChoiceB", "ChoiceC"), shuffle = TRUE, orientation = "vertical")
Class MultipleChoice is responsible for creating multiple choice
assessment task according to QTI 2.1.
identifierA character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits.
titleA character representing the title of the XML file associated with the task. By default, it takes the value of the identifier.
contentA list of character content to form the text of the question, which can include HTML tags. For tasks of the Entry type, it must also contain at least one instance of Gap objects, such as TextGap, TextGapOpal, NumericGap, or InlineChoice.
promptAn optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "".
pointsA numeric value, optional, representing the number of points for the entire task. Default is 1, but pay attention:
For tasks of the Entry type, it is calculated as the sum of the gap points by default.
For tasks of the DirectedPair, the default is calculated as 0.5 points per pair.
For tasks of the MatchTable type, it can also be calculated as the sum of points for individual answers, when provided.
For tasks of the MultipleChoice type, points is numeric vector and
required. Each number in this vector determines the number of points that
will be awarded to a candidate if they select the corresponding answer. The
order of the scores must match the order of the choices. It is possible
to assign negative values to incorrect answers. All answers with a
positive score are considered correct.
feedbackA list containing feedback messages for candidates. Each element of the list should be an instance of either ModalFeedback, CorrectFeedback, or WrongFeedback class.
calculatorA character, optional, determining whether to show a calculator to the candidate. Possible values:
"simple"
"scientific"
filesA character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam.
metadataAn object of class QtiMetadata that holds metadata information about the task.
stylesheet_pathOptional character vector of local CSS file paths. Stylesheets are linked from the item and included in QTI exports. In Rmd YAML, relative paths are resolved against the Rmd file's directory.
cssOptional single character string of CSS text, linked after any
files in stylesheet_path. In Rmd YAML, use a literal block (css: |).
CSS assets referenced by url() or @import are not bundled automatically.
choicesA character vector defining a set of answer options in the question.
choice_identifiersA character vector, optional, containing a set of identifiers for answers. By default, identifiers are generated automatically according to the template "ChoiceD", where D is a letter representing the alphabetical order of the answer in the list.
shuffleA boolean value indicating whether to randomize the order in
which the choices are initially presented to the candidate. Default is
TRUE.
orientationA character, determining whether to place answers in vertical or horizontal mode. Possible values:
"vertical" - Default.
"horizontal"
scoring_schemeA method name or named list from multiple_choice_scoring().
Defaults to "standard", preserving the existing weighted mapping.
mc <- new("MultipleChoice", identifier = "id_task_1234", title = "Multiple Choice Task", content = list("<p>Pick up the right options</p>"), prompt = "Plain text, can be used instead of content", points = c(1, -1, 1, -1), feedback = list(new("WrongFeedback", content = list("Wrong answer"))), calculator = "scientific-calculator", files = "text_book.pdf", choices = c("option 1", "option 2", "option 3", "option 4"), choice_identifiers = c("ChoiceA", "ChoiceB", "ChoiceC", "ChoiceD"), shuffle = TRUE, orientation = "vertical")mc <- new("MultipleChoice", identifier = "id_task_1234", title = "Multiple Choice Task", content = list("<p>Pick up the right options</p>"), prompt = "Plain text, can be used instead of content", points = c(1, -1, 1, -1), feedback = list(new("WrongFeedback", content = list("Wrong answer"))), calculator = "scientific-calculator", files = "text_book.pdf", choices = c("option 1", "option 2", "option 3", "option 4"), choice_identifiers = c("ChoiceA", "ChoiceB", "ChoiceC", "ChoiceD"), shuffle = TRUE, orientation = "vertical")
Create object MultipleChoiceTable
multipleChoiceTable( identifier = generate_id(), title = identifier, content = list(), prompt = "", points = 1, rows, rows_identifiers, cols, cols_identifiers, answers_identifiers, answers_scores = NA_real_, shuffle = TRUE, shuffle_rows = TRUE, shuffle_cols = TRUE, feedback = list(), calculator = NA_character_, files = NA_character_ )multipleChoiceTable( identifier = generate_id(), title = identifier, content = list(), prompt = "", points = 1, rows, rows_identifiers, cols, cols_identifiers, answers_identifiers, answers_scores = NA_real_, shuffle = TRUE, shuffle_rows = TRUE, shuffle_cols = TRUE, feedback = list(), calculator = NA_character_, files = NA_character_ )
identifier |
A character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits. |
title |
A character representing the title of the XML file associated with the task. By default, it takes the value of the identifier. |
content |
A character string or a list of character strings to form the text of the question, which may include HTML tags. |
prompt |
An optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "". |
points |
A numeric value, optional, representing the number of points for the entire task. It can also be calculated as the sum of points for individual answers, when provided. Default is 1. |
rows |
A character vector specifying answer options defined in rows of the table. |
rows_identifiers |
A character vector, optional, specifies identifiers of the rows of the table |
cols |
A character vector specifying answer options defined in columns of the table. |
cols_identifiers |
A character vector, optional, specifies identifiers of the columns of the table. |
answers_identifiers |
A character vector specifying couples of identifiers that combine the correct answers. |
answers_scores |
A numeric vector, optional, where each number determines the number of points awarded to a candidate if they select the corresponding answer. If not assigned, the individual values for correct answers are calculated from the task points and the number of correct options. |
shuffle |
A boolean value, optional, determining whether to randomize the
order in which the choices are initially presented to the candidate. Default
is |
shuffle_rows |
A boolean value, optional, determining whether to
randomize the order of the choices only for the first elements of the answer
tuples. Default is |
shuffle_cols |
A boolean value, optional, determining whether to
randomize the order of the choices only for the second elements of the
answer tuples. Default is |
feedback |
A list containing feedback message-object ModalFeedback for candidates. |
calculator |
A character, optional, determining whether to show a calculator to the candidate. Possible values:
|
files |
A character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam. |
An object of class MultipleChoiceTable
mt_min <- multipleChoiceTable(content = "<p>\"Multiple choice table\" task</p>", rows = c("alfa", "beta", "gamma", "alpha"), rows_identifiers = c("a", "b", "g", "aa"), cols = c("A", "B", "G", "a"), cols_identifiers = c("as", "bs", "gs", "aas"), answers_identifiers = c("a as", "b bs", "g gs", "aa as", "a aas", "aa aas")) mt <- multipleChoiceTable(identifier = "id_task_1234", title = "Table with many possible answers in rows and cols", content = "<p>\"Multiple choice table\" task</p>", prompt = "Plain text, can be used instead of the content", rows = c("alfa", "beta", "gamma", "alpha"), rows_identifiers = c("a", "b", "g", "aa"), cols = c("A", "B", "G", "a"), cols_identifiers = c("as", "bs", "gs", "aas"), answers_identifiers = c("a as", "b bs", "g gs", "aa as", "a aas", "aa aas"), answers_scores = c(1, 0.5, 0.1, 1, 0.5, 1), shuffle_rows = FALSE, shuffle_cols = TRUE)mt_min <- multipleChoiceTable(content = "<p>\"Multiple choice table\" task</p>", rows = c("alfa", "beta", "gamma", "alpha"), rows_identifiers = c("a", "b", "g", "aa"), cols = c("A", "B", "G", "a"), cols_identifiers = c("as", "bs", "gs", "aas"), answers_identifiers = c("a as", "b bs", "g gs", "aa as", "a aas", "aa aas")) mt <- multipleChoiceTable(identifier = "id_task_1234", title = "Table with many possible answers in rows and cols", content = "<p>\"Multiple choice table\" task</p>", prompt = "Plain text, can be used instead of the content", rows = c("alfa", "beta", "gamma", "alpha"), rows_identifiers = c("a", "b", "g", "aa"), cols = c("A", "B", "G", "a"), cols_identifiers = c("as", "bs", "gs", "aas"), answers_identifiers = c("a as", "b bs", "g gs", "aa as", "a aas", "aa aas"), answers_scores = c(1, 0.5, 0.1, 1, 0.5, 1), shuffle_rows = FALSE, shuffle_cols = TRUE)
Class MultipleChoiceTable is responsible for creating assessment tasks
according to the QTI 2.1 standard with a table of answer options, where many
correct answers in each row and column are possible.
identifierA character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits.
titleA character representing the title of the XML file associated with the task. By default, it takes the value of the identifier.
contentA list of character content to form the text of the question, which can include HTML tags. For tasks of the Entry type, it must also contain at least one instance of Gap objects, such as TextGap, TextGapOpal, NumericGap, or InlineChoice.
promptAn optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "".
pointsA numeric value, optional, representing the number of points for the entire task. Default is 1, but pay attention:
For tasks of the Entry type, it is calculated as the sum of the gap points by default.
For tasks of the DirectedPair, the default is calculated as 0.5 points per pair.
For tasks of the MatchTable type, it can also be calculated as the sum of points for individual answers, when provided.
For tasks of the MultipleChoice type, points is numeric vector and
required. Each number in this vector determines the number of points that
will be awarded to a candidate if they select the corresponding answer. The
order of the scores must match the order of the choices. It is possible
to assign negative values to incorrect answers. All answers with a
positive score are considered correct.
feedbackA list containing feedback messages for candidates. Each element of the list should be an instance of either ModalFeedback, CorrectFeedback, or WrongFeedback class.
calculatorA character, optional, determining whether to show a calculator to the candidate. Possible values:
"simple"
"scientific"
filesA character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam.
metadataAn object of class QtiMetadata that holds metadata information about the task.
stylesheet_pathOptional character vector of local CSS file paths. Stylesheets are linked from the item and included in QTI exports. In Rmd YAML, relative paths are resolved against the Rmd file's directory.
cssOptional single character string of CSS text, linked after any
files in stylesheet_path. In Rmd YAML, use a literal block (css: |).
CSS assets referenced by url() or @import are not bundled automatically.
rowsA character vector specifying answer options as row names in the table or the first elements in couples in DirectedPair.
rows_identifiersA character vector, optional, specifying identifiers for answer options defined in rows of the table or identifiers of the first elements in couples in DirectedPair.
colsA character vector specifying answer options as column headers in the table or the second elements in couples in DirectedPair.
cols_identifiersA character vector, optional, specifying identifiers for answer options defined in columns of the table or identifiers of the second elements in couples in DirectedPair.
answers_identifiersA character vector specifying couples of identifiers that combine the correct answers.
answers_scoresA numeric vector, optional, where each number determines the number of points awarded to a candidate if they select the corresponding answer. If not assigned, the individual values for correct answers are calculated from the task points and the number of correct options.
shuffleA boolean value, optional, determining whether to randomize the
order in which the choices are initially presented to the candidate.
Default is TRUE.
shuffle_rowsA boolean value, optional, determining whether to
randomize the order of the choices only in rows. Default is TRUE.
shuffle_colsA boolean value, optional, determining whether to
randomize the order of the choices only in columns. Default is TRUE.
mappingDo not use directly; values are initialized automatically. This slot contains a named numeric vector of points, where names correspond to all possible combinations of row and column identifiers.
mt <- new("MultipleChoiceTable", identifier = "id_task_1234", title = "Multiple choice table", content = list("<p>Match table task</p>", "<i>table description</i>"), points = 5, rows = c("row1", "row2", "row3"), rows_identifiers = c("a", "b", "c"), cols = c("alfa", "beta", "gamma"), cols_identifiers = c("a", "b", "c"), answers_identifiers = c("a a", "b b", "b c"), shuffle = TRUE)mt <- new("MultipleChoiceTable", identifier = "id_task_1234", title = "Multiple choice table", content = list("<p>Match table task</p>", "<i>table description</i>"), points = 5, rows = c("row1", "row2", "row3"), rows_identifiers = c("a", "b", "c"), cols = c("alfa", "beta", "gamma"), cols_identifiers = c("a", "b", "c"), answers_identifiers = c("a a", "b b", "b c"), shuffle = TRUE)
Create object NumericGap
numericGap( solution, response_identifier = generate_id(type = "gap"), points = 1, placeholder = "", expected_length = size_gap(solution), tolerance = 0, tolerance_type = "absolute", include_lower_bound = TRUE, include_upper_bound = TRUE ) gapNumeric( solution, response_identifier = generate_id(type = "gap"), points = 1, placeholder = "", expected_length = size_gap(solution), tolerance = 0, tolerance_type = "absolute", include_lower_bound = TRUE, include_upper_bound = TRUE )numericGap( solution, response_identifier = generate_id(type = "gap"), points = 1, placeholder = "", expected_length = size_gap(solution), tolerance = 0, tolerance_type = "absolute", include_lower_bound = TRUE, include_upper_bound = TRUE ) gapNumeric( solution, response_identifier = generate_id(type = "gap"), points = 1, placeholder = "", expected_length = size_gap(solution), tolerance = 0, tolerance_type = "absolute", include_lower_bound = TRUE, include_upper_bound = TRUE )
solution |
A numeric value containing the correct answer for this numeric entry. |
response_identifier |
A character value representing an identifier for the answer. By default, it is generated as 'id_gap_dddd', where dddd represents random digits. |
points |
A numeric value, optional, representing the number of points for this gap. Default is 1 |
placeholder |
A character value, optional, used to place helpful text in the text input field in the content delivery engine. Default is "". |
expected_length |
A numeric value, optional, used to set the size of the text input field in the content delivery engine. Default value is adjusted by solution size. |
tolerance |
A numeric value, optional, specifying the value for the upper and lower boundaries of the tolerance rate for candidate answers. Default is 0. |
tolerance_type |
A character value, optional, specifying the tolerance mode. Possible values:
|
include_lower_bound |
A boolean value, optional, specifying whether the
lower bound is included in the tolerance rate. Default is |
include_upper_bound |
A boolean value, optional, specifying whether the
upper bound is included in the tolerance rate. Default is |
An object of class NumericGap
[entry()][textGap()][textGapOpal()]
ng_min <- numericGap(5.1) ng <- numericGap(solution = 5.1, response_identifier = "id_gap_1234", points = 2, placeholder = "put your answer here", expected_length = 4, tolerance = 5, tolerance_type = "relative")ng_min <- numericGap(5.1) ng <- numericGap(solution = 5.1, response_identifier = "id_gap_1234", points = 2, placeholder = "put your answer here", expected_length = 4, tolerance = 5, tolerance_type = "relative")
Class NumericGap is responsible for creating instances of input fields with
numeric type of answers in question Entry type assessment tasks according
to the QTI 2.1 standard.
response_identifierA character value representing an identifier for the answer. By default, it is generated as 'id_gap_dddd', where dddd represents random digits.
pointsA numeric value, optional, representing the number of points for
this gap. Default is 1.
placeholderA character value, optional, used to place helpful text in the text input field in the content delivery engine.
expected_lengthA numeric value, optional, used to set the size of the text input field in the content delivery engine.
solutionA numeric value containing the correct answer for this numeric entry.
toleranceA numeric value, optional, specifying the value for the upper and lower boundaries of the tolerance rate for candidate answers. Default is 0.
tolerance_typeA character value, optional, specifying the tolerance mode. Possible values:
"exact"
"absolute" - Default.
"relative"
include_lower_boundA boolean value, optional, specifying whether the
lower bound is included in the tolerance rate. Default is TRUE.
include_upper_boundA boolean value, optional, specifying whether the
upper bound is included in the tolerance rate. Default is TRUE.
Entry, TextGap, TextGapOpal and InlineChoice.
ng <- new("NumericGap", response_identifier = "id_gap_1234", points = 1, placeholder = "use this format xx.xxx", solution = 5, tolerance = 1, tolerance_type = "relative", include_lower_bound = TRUE, include_upper_bound = TRUE)ng <- new("NumericGap", response_identifier = "id_gap_1234", points = 1, placeholder = "use this format xx.xxx", solution = 5, tolerance = 1, tolerance_type = "relative", include_lower_bound = TRUE, include_upper_bound = TRUE)
Create object OneInColTable
oneInColTable( identifier = generate_id(), title = identifier, content = list(), prompt = "", points = 1, rows, rows_identifiers, cols, cols_identifiers, answers_identifiers, answers_scores = NA_real_, shuffle = TRUE, shuffle_rows = TRUE, shuffle_cols = TRUE, feedback = list(), calculator = NA_character_, files = NA_character_ )oneInColTable( identifier = generate_id(), title = identifier, content = list(), prompt = "", points = 1, rows, rows_identifiers, cols, cols_identifiers, answers_identifiers, answers_scores = NA_real_, shuffle = TRUE, shuffle_rows = TRUE, shuffle_cols = TRUE, feedback = list(), calculator = NA_character_, files = NA_character_ )
identifier |
A character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits. |
title |
A character representing the title of the XML file associated with the task. By default, it takes the value of the identifier. |
content |
A character string or a list of character strings to form the text of the question, which may include HTML tags. |
prompt |
An optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "". |
points |
A numeric value, optional, representing the number of points for the entire task. It can also be calculated as the sum of points for individual answers, when provided. Default is 1. |
rows |
A character vector specifying answer options defined in rows of the table. |
rows_identifiers |
A character vector, optional, specifies identifiers of the rows of the table |
cols |
A character vector specifying answer options defined in columns of the table. |
cols_identifiers |
A character vector, optional, specifies identifiers of the columns of the table. |
answers_identifiers |
A character vector specifying couples of identifiers that combine the correct answers. |
answers_scores |
A numeric vector, optional, where each number determines the number of points awarded to a candidate if they select the corresponding answer. If not assigned, the individual values for correct answers are calculated from the task points and the number of correct options. |
shuffle |
A boolean value, optional, determining whether to randomize the
order in which the choices are initially presented to the candidate. Default
is |
shuffle_rows |
A boolean value, optional, determining whether to
randomize the order of the choices only for the first elements of the answer
tuples. Default is |
shuffle_cols |
A boolean value, optional, determining whether to
randomize the order of the choices only for the second elements of the
answer tuples. Default is |
feedback |
A list containing feedback message-object ModalFeedback for candidates. |
calculator |
A character, optional, determining whether to show a calculator to the candidate. Possible values:
|
files |
A character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam. |
An object of class OneInColTable
ct_min <- oneInColTable(content = "<p>\"One in column table\" task</p>", rows = c("alfa", "beta", "gamma"), rows_identifiers = c("a", "b", "g"), cols = c("A", "B", "G", "a"), cols_identifiers = c("as", "bs", "gs", "aas"), answers_identifiers = c("a as", "b bs", "g gs", "a aas")) ct <- oneInColTable(identifier = "id_task_1234", title = "Table with one answer per column", content = "<p>\"One in column table\" task</p>", prompt = "Plain text, can be used instead of the content", rows = c("alfa", "beta", "gamma"), rows_identifiers = c("a", "b", "g"), cols = c("A", "B", "G", "a"), cols_identifiers = c("as", "bs", "gs", "aas"), answers_identifiers = c("a as", "b bs", "g gs", "a aas"), answers_scores = c(1, 0.5, 0.1, 1), shuffle_rows = FALSE, shuffle_cols = TRUE)ct_min <- oneInColTable(content = "<p>\"One in column table\" task</p>", rows = c("alfa", "beta", "gamma"), rows_identifiers = c("a", "b", "g"), cols = c("A", "B", "G", "a"), cols_identifiers = c("as", "bs", "gs", "aas"), answers_identifiers = c("a as", "b bs", "g gs", "a aas")) ct <- oneInColTable(identifier = "id_task_1234", title = "Table with one answer per column", content = "<p>\"One in column table\" task</p>", prompt = "Plain text, can be used instead of the content", rows = c("alfa", "beta", "gamma"), rows_identifiers = c("a", "b", "g"), cols = c("A", "B", "G", "a"), cols_identifiers = c("as", "bs", "gs", "aas"), answers_identifiers = c("a as", "b bs", "g gs", "a aas"), answers_scores = c(1, 0.5, 0.1, 1), shuffle_rows = FALSE, shuffle_cols = TRUE)
Class OneInColTable is responsible for creating assessment tasks according
to the QTI 2.1 standard with a table of answer options, where only one
correct answer in each column is possible.
identifierA character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits.
titleA character representing the title of the XML file associated with the task. By default, it takes the value of the identifier.
contentA list of character content to form the text of the question, which can include HTML tags. For tasks of the Entry type, it must also contain at least one instance of Gap objects, such as TextGap, TextGapOpal, NumericGap, or InlineChoice.
promptAn optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "".
pointsA numeric value, optional, representing the number of points for the entire task. Default is 1, but pay attention:
For tasks of the Entry type, it is calculated as the sum of the gap points by default.
For tasks of the DirectedPair, the default is calculated as 0.5 points per pair.
For tasks of the MatchTable type, it can also be calculated as the sum of points for individual answers, when provided.
For tasks of the MultipleChoice type, points is numeric vector and
required. Each number in this vector determines the number of points that
will be awarded to a candidate if they select the corresponding answer. The
order of the scores must match the order of the choices. It is possible
to assign negative values to incorrect answers. All answers with a
positive score are considered correct.
feedbackA list containing feedback messages for candidates. Each element of the list should be an instance of either ModalFeedback, CorrectFeedback, or WrongFeedback class.
calculatorA character, optional, determining whether to show a calculator to the candidate. Possible values:
"simple"
"scientific"
filesA character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam.
metadataAn object of class QtiMetadata that holds metadata information about the task.
stylesheet_pathOptional character vector of local CSS file paths. Stylesheets are linked from the item and included in QTI exports. In Rmd YAML, relative paths are resolved against the Rmd file's directory.
cssOptional single character string of CSS text, linked after any
files in stylesheet_path. In Rmd YAML, use a literal block (css: |).
CSS assets referenced by url() or @import are not bundled automatically.
rowsA character vector specifying answer options as row names in the table or the first elements in couples in DirectedPair.
rows_identifiersA character vector, optional, specifying identifiers for answer options defined in rows of the table or identifiers of the first elements in couples in DirectedPair.
colsA character vector specifying answer options as column headers in the table or the second elements in couples in DirectedPair.
cols_identifiersA character vector, optional, specifying identifiers for answer options defined in columns of the table or identifiers of the second elements in couples in DirectedPair.
answers_identifiersA character vector specifying couples of identifiers that combine the correct answers.
answers_scoresA numeric vector, optional, where each number determines the number of points awarded to a candidate if they select the corresponding answer. If not assigned, the individual values for correct answers are calculated from the task points and the number of correct options.
shuffleA boolean value, optional, determining whether to randomize the
order in which the choices are initially presented to the candidate.
Default is TRUE.
shuffle_rowsA boolean value, optional, determining whether to
randomize the order of the choices only in rows. Default is TRUE.
shuffle_colsA boolean value, optional, determining whether to
randomize the order of the choices only in columns. Default is TRUE.
mt <- new("OneInColTable", identifier = "id_task_1234", title = "One in Col choice table", content = list("<p>\"One in col\" table task</p>", "<i>table description</i>"), points = 5, rows = c("row1", "row2", "row3", "row4"), rows_identifiers = c("a", "b", "c", "d"), cols = c("alfa", "beta", "gamma"), cols_identifiers = c("k", "l", "m"), answers_identifiers = c("a k", "d l", 'd m'), shuffle = TRUE)mt <- new("OneInColTable", identifier = "id_task_1234", title = "One in Col choice table", content = list("<p>\"One in col\" table task</p>", "<i>table description</i>"), points = 5, rows = c("row1", "row2", "row3", "row4"), rows_identifiers = c("a", "b", "c", "d"), cols = c("alfa", "beta", "gamma"), cols_identifiers = c("k", "l", "m"), answers_identifiers = c("a k", "d l", 'd m'), shuffle = TRUE)
Create object OneInRowTable
oneInRowTable( identifier = generate_id(), title = identifier, content = list(), prompt = "", points = 1, rows, rows_identifiers, cols, cols_identifiers, answers_identifiers, answers_scores = NA_real_, shuffle = TRUE, shuffle_rows = TRUE, shuffle_cols = TRUE, feedback = list(), calculator = NA_character_, files = NA_character_ )oneInRowTable( identifier = generate_id(), title = identifier, content = list(), prompt = "", points = 1, rows, rows_identifiers, cols, cols_identifiers, answers_identifiers, answers_scores = NA_real_, shuffle = TRUE, shuffle_rows = TRUE, shuffle_cols = TRUE, feedback = list(), calculator = NA_character_, files = NA_character_ )
identifier |
A character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits. |
title |
A character representing the title of the XML file associated with the task. By default, it takes the value of the identifier. |
content |
A character string or a list of character strings to form the text of the question, which may include HTML tags. |
prompt |
An optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "". |
points |
A numeric value, optional, representing the number of points for the entire task. It can also be calculated as the sum of points for individual answers, when provided. Default is 1. |
rows |
A character vector specifying answer options defined in rows of the table. |
rows_identifiers |
A character vector, optional, specifies identifiers of the rows of the table |
cols |
A character vector specifying answer options defined in columns of the table. |
cols_identifiers |
A character vector, optional, specifies identifiers of the columns of the table. |
answers_identifiers |
A character vector specifying couples of identifiers that combine the correct answers. |
answers_scores |
A numeric vector, optional, where each number determines the number of points awarded to a candidate if they select the corresponding answer. If not assigned, the individual values for correct answers are calculated from the task points and the number of correct options. |
shuffle |
A boolean value, optional, determining whether to randomize the
order in which the choices are initially presented to the candidate. Default
is |
shuffle_rows |
A boolean value, optional, determining whether to
randomize the order of the choices only for the first elements of the answer
tuples. Default is |
shuffle_cols |
A boolean value, optional, determining whether to
randomize the order of the choices only for the second elements of the
answer tuples. Default is |
feedback |
A list containing feedback message-object ModalFeedback for candidates. |
calculator |
A character, optional, determining whether to show a calculator to the candidate. Possible values:
|
files |
A character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam. |
An object of class OneInRowTable
rt_min <- oneInRowTable(content = "<p>\"One in row table\" task</p>", rows = c("alfa", "beta", "gamma", "alpha"), rows_identifiers = c("a", "b", "g", "aa"), cols = c("A", "B", "G"), cols_identifiers = c("as", "bs", "gs"), answers_identifiers = c("a as", "b bs", "g gs", "aa as")) rt <- oneInRowTable(identifier = "id_task_1234", title = "Table with one answer per row", content = "<p>\"One in row table\" task</p>", prompt = "Plain text, can be used instead of the content", rows = c("alfa", "beta", "gamma", "alpha"), rows_identifiers = c("a", "b", "g", "aa"), cols = c("A", "B", "G"), cols_identifiers = c("as", "bs", "gs"), answers_identifiers = c("a as", "b bs", "g gs", "aa as"), answers_scores = c(1, 0.5, 0.1, 1), shuffle_rows = FALSE, shuffle_cols = TRUE)rt_min <- oneInRowTable(content = "<p>\"One in row table\" task</p>", rows = c("alfa", "beta", "gamma", "alpha"), rows_identifiers = c("a", "b", "g", "aa"), cols = c("A", "B", "G"), cols_identifiers = c("as", "bs", "gs"), answers_identifiers = c("a as", "b bs", "g gs", "aa as")) rt <- oneInRowTable(identifier = "id_task_1234", title = "Table with one answer per row", content = "<p>\"One in row table\" task</p>", prompt = "Plain text, can be used instead of the content", rows = c("alfa", "beta", "gamma", "alpha"), rows_identifiers = c("a", "b", "g", "aa"), cols = c("A", "B", "G"), cols_identifiers = c("as", "bs", "gs"), answers_identifiers = c("a as", "b bs", "g gs", "aa as"), answers_scores = c(1, 0.5, 0.1, 1), shuffle_rows = FALSE, shuffle_cols = TRUE)
Class OneInRowTable is responsible for creating assessment tasks according
to the QTI 2.1 standard with a table of answer options, where only one
correct answer in each row is possible.
identifierA character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits.
titleA character representing the title of the XML file associated with the task. By default, it takes the value of the identifier.
contentA list of character content to form the text of the question, which can include HTML tags. For tasks of the Entry type, it must also contain at least one instance of Gap objects, such as TextGap, TextGapOpal, NumericGap, or InlineChoice.
promptAn optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "".
pointsA numeric value, optional, representing the number of points for the entire task. Default is 1, but pay attention:
For tasks of the Entry type, it is calculated as the sum of the gap points by default.
For tasks of the DirectedPair, the default is calculated as 0.5 points per pair.
For tasks of the MatchTable type, it can also be calculated as the sum of points for individual answers, when provided.
For tasks of the MultipleChoice type, points is numeric vector and
required. Each number in this vector determines the number of points that
will be awarded to a candidate if they select the corresponding answer. The
order of the scores must match the order of the choices. It is possible
to assign negative values to incorrect answers. All answers with a
positive score are considered correct.
feedbackA list containing feedback messages for candidates. Each element of the list should be an instance of either ModalFeedback, CorrectFeedback, or WrongFeedback class.
calculatorA character, optional, determining whether to show a calculator to the candidate. Possible values:
"simple"
"scientific"
filesA character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam.
metadataAn object of class QtiMetadata that holds metadata information about the task.
stylesheet_pathOptional character vector of local CSS file paths. Stylesheets are linked from the item and included in QTI exports. In Rmd YAML, relative paths are resolved against the Rmd file's directory.
cssOptional single character string of CSS text, linked after any
files in stylesheet_path. In Rmd YAML, use a literal block (css: |).
CSS assets referenced by url() or @import are not bundled automatically.
rowsA character vector specifying answer options as row names in the table or the first elements in couples in DirectedPair.
rows_identifiersA character vector, optional, specifying identifiers for answer options defined in rows of the table or identifiers of the first elements in couples in DirectedPair.
colsA character vector specifying answer options as column headers in the table or the second elements in couples in DirectedPair.
cols_identifiersA character vector, optional, specifying identifiers for answer options defined in columns of the table or identifiers of the second elements in couples in DirectedPair.
answers_identifiersA character vector specifying couples of identifiers that combine the correct answers.
answers_scoresA numeric vector, optional, where each number determines the number of points awarded to a candidate if they select the corresponding answer. If not assigned, the individual values for correct answers are calculated from the task points and the number of correct options.
shuffleA boolean value, optional, determining whether to randomize the
order in which the choices are initially presented to the candidate.
Default is TRUE.
shuffle_rowsA boolean value, optional, determining whether to
randomize the order of the choices only in rows. Default is TRUE.
shuffle_colsA boolean value, optional, determining whether to
randomize the order of the choices only in columns. Default is TRUE.
mt <- new("OneInRowTable", identifier = "id_task_1234", title = "One in Row choice table", content = list("<p>\"One in row\" table task</p>", "<i>table description</i>"), points = 5, rows = c("row1", "row2", "row3", "row4"), rows_identifiers = c("a", "b", "c", "d"), cols = c("alfa", "beta", "gamma"), cols_identifiers = c("k", "l", "m"), answers_identifiers = c("a k", "b l", "c l", "d m"), shuffle = TRUE)mt <- new("OneInRowTable", identifier = "id_task_1234", title = "One in Row choice table", content = list("<p>\"One in row\" table task</p>", "<i>table description</i>"), points = 5, rows = c("row1", "row2", "row3", "row4"), rows_identifiers = c("a", "b", "c", "d"), cols = c("alfa", "beta", "gamma"), cols_identifiers = c("k", "l", "m"), answers_identifiers = c("a k", "b l", "c l", "d m"), shuffle = TRUE)
This helper function initializes an Opal object, a subclass of LMS,
representing a connection to the Opal Learning Management System (LMS).
opal( api_user = NA_character_, endpoint = NA_character_, credential_id = NA_character_ )opal( api_user = NA_character_, endpoint = NA_character_, credential_id = NA_character_ )
api_user |
A character string specifying the API username. |
endpoint |
A character string specifying the API endpoint for the LMS. |
credential_id |
An optional name for the credential set. By default,
rqti derives the credential service from |
Interactive first-time setup still prompts for a username and
password when neither endpoint-specific nor legacy credentials exist. A
legacy rqtiopal entry is otherwise used as a fallback. Use
set_opal_credentials() when an endpoint needs a different password.
An object of class Opal, inheriting from LMS,
which can be used to interact with the Opal LMS API.
The Opal class represents a specific implementation of a Learning Management
System (LMS) that extends the abstract LMS class. This class is designed to
facilitate interactions with the Opal LMS API.
nameA character string representing the name/identifier of the LMS.
Defaults to "Opal".
api_userA character string specifying the API username for authentication.
endpointA character string containing the API endpoint of the Opal LMS.
This can be set using the environment variable RQTI_API_ENDPOINT with
Sys.setenv(RQTI_API_ENDPOINT='xxxxxxxxxxxxxxx') or placed in the .Renviron file.
credential_idA character string identifying this endpoint's credentials
in the operating-system keyring. If omitted, a service name is derived from
the endpoint, with the legacy rqtiopal service used as a fallback.
LMS-class for the parent class.
Create object Ordering
ordering( identifier = generate_id(), title = identifier, choices, choices_identifiers = paste0("Choice", LETTERS[seq(choices)]), content = list(), prompt = "", points = 1, points_per_answer = TRUE, shuffle = TRUE, feedback = list(), calculator = NA_character_, files = NA_character_ )ordering( identifier = generate_id(), title = identifier, choices, choices_identifiers = paste0("Choice", LETTERS[seq(choices)]), content = list(), prompt = "", points = 1, points_per_answer = TRUE, shuffle = TRUE, feedback = list(), calculator = NA_character_, files = NA_character_ )
identifier |
A character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits. |
title |
A character representing the title of the XML file associated with the task. By default, it takes the value of the identifier. |
choices |
A character vector containing the answers. The order of answers in the vector represents the correct response for the task. |
choices_identifiers |
A character vector, optional, containing a set of identifiers for answers. By default, identifiers are generated automatically according to the template "ChoiceD", where D is a letter representing the alphabetical order of the answer in the list. |
content |
A character string or a list of character strings to form the text of the question, which may include HTML tags. |
prompt |
An optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "". |
points |
A numeric value, optional, representing the number of points for the entire task. Default is 1. |
points_per_answer |
A boolean value indicating the scoring method. If
|
shuffle |
A boolean value indicating whether to randomize the order in
which the choices are initially presented to the candidate. Default is
|
feedback |
A list containing feedback messages for candidates. Each element of the list should be an instance of either ModalFeedback, CorrectFeedback, or WrongFeedback class. |
calculator |
A character, optional, determining whether to show a calculator to the candidate. Possible values:
|
files |
A character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam. |
An object of class Ordering
ord_min <- ordering(prompt = "Set the right order:", choices = c("Step1", "Step2", "Step3")) ord <- ordering(identifier = "id_task_1234", title = "Order Task", choices = c("Step1", "Step2", "Step3"), choices_identifiers = c("a", "b", "c"), content = "<p>Set the right order</p>", prompt = "Plain text, can be used instead of content", points = 2, points_per_answer = FALSE, shuffle = FALSE, feedback = list(new("WrongFeedback", content = list("Wrong answer"))), calculator = "scientific-calculator", files = "text_book.pdf")ord_min <- ordering(prompt = "Set the right order:", choices = c("Step1", "Step2", "Step3")) ord <- ordering(identifier = "id_task_1234", title = "Order Task", choices = c("Step1", "Step2", "Step3"), choices_identifiers = c("a", "b", "c"), content = "<p>Set the right order</p>", prompt = "Plain text, can be used instead of content", points = 2, points_per_answer = FALSE, shuffle = FALSE, feedback = list(new("WrongFeedback", content = list("Wrong answer"))), calculator = "scientific-calculator", files = "text_book.pdf")
Class Ordering is responsible for creating assessment task according
to QTI 2.1., where candidate has to place answers in a specific order
identifierA character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits.
titleA character representing the title of the XML file associated with the task. By default, it takes the value of the identifier.
contentA list of character content to form the text of the question, which can include HTML tags. For tasks of the Entry type, it must also contain at least one instance of Gap objects, such as TextGap, TextGapOpal, NumericGap, or InlineChoice.
promptAn optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "".
pointsA numeric value, optional, representing the number of points for the entire task. Default is 1, but pay attention:
For tasks of the Entry type, it is calculated as the sum of the gap points by default.
For tasks of the DirectedPair, the default is calculated as 0.5 points per pair.
For tasks of the MatchTable type, it can also be calculated as the sum of points for individual answers, when provided.
For tasks of the MultipleChoice type, points is numeric vector and
required. Each number in this vector determines the number of points that
will be awarded to a candidate if they select the corresponding answer. The
order of the scores must match the order of the choices. It is possible
to assign negative values to incorrect answers. All answers with a
positive score are considered correct.
feedbackA list containing feedback messages for candidates. Each element of the list should be an instance of either ModalFeedback, CorrectFeedback, or WrongFeedback class.
calculatorA character, optional, determining whether to show a calculator to the candidate. Possible values:
"simple"
"scientific"
filesA character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam.
metadataAn object of class QtiMetadata that holds metadata information about the task.
stylesheet_pathOptional character vector of local CSS file paths. Stylesheets are linked from the item and included in QTI exports. In Rmd YAML, relative paths are resolved against the Rmd file's directory.
cssOptional single character string of CSS text, linked after any
files in stylesheet_path. In Rmd YAML, use a literal block (css: |).
CSS assets referenced by url() or @import are not bundled automatically.
choicesA character vector containing the answers. The order of answers in the vector represents the correct response for the task.
choices_identifiersA character vector, optional, containing a set of identifiers for answers. By default, identifiers are generated automatically. By default, identifiers are generated automatically according to the template "ChoiceL", where L is a letter representing the alphabetical order of the answer in the list.
shuffleA boolean value indicating whether to randomize the order in which the choices are initially presented to the candidate. Default is TRUE.
points_per_answerA boolean value indicating the scoring method.
If TRUE, each selected answer will be scored individually.
If FALSE, only fully correct answers will be scored with the maximum score.
Default is TRUE.
ord <- new("Ordering", identifier = "id_task_1234", title = "order", content = list("<p>Put these items in a right order</p>"), prompt = "", points = 2, feedback = list(), choices = c("first", "second", "third"), choices_identifiers = c("ChoiceA", "ChoiceB", "ChoiceC"), shuffle = TRUE, points_per_answer = TRUE)ord <- new("Ordering", identifier = "id_task_1234", title = "order", content = list("<p>Put these items in a right order</p>"), prompt = "", points = 2, feedback = list(), choices = c("first", "second", "third"), choices_identifiers = c("ChoiceA", "ChoiceB", "ChoiceC"), shuffle = TRUE, points_per_answer = TRUE)
Starts server for qtijs, returns path of qtijs and the url of the server.
prepare_renderer(qtijs_path = qtijs_pkg_path())prepare_renderer(qtijs_path = qtijs_pkg_path())
qtijs_path |
The path to the qtijs renderer (qti.js), which will be started with servr::httw and to which xml files will be copied. Default is the QTIJS folder in the R package rqti local installation via the helper qtijs_pkg_path(). |
Prepare files to render them with QTIJS
prepareQTIJSFiles(object, dir = NULL) ## S4 method for signature 'AssessmentItem' prepareQTIJSFiles(object, dir = "") ## S4 method for signature 'AssessmentSection' prepareQTIJSFiles(object, dir = NULL) ## S4 method for signature 'AssessmentTest' prepareQTIJSFiles(object, dir = NULL) ## S4 method for signature 'character' prepareQTIJSFiles(object, dir = NULL)prepareQTIJSFiles(object, dir = NULL) ## S4 method for signature 'AssessmentItem' prepareQTIJSFiles(object, dir = "") ## S4 method for signature 'AssessmentSection' prepareQTIJSFiles(object, dir = NULL) ## S4 method for signature 'AssessmentTest' prepareQTIJSFiles(object, dir = NULL) ## S4 method for signature 'character' prepareQTIJSFiles(object, dir = NULL)
object |
an instance of AssessmentItem, AssessmentTest, AssessmentTestOpal, AssessmentSection, or string path to xml, rmd or md files |
dir |
QTIJS path |
Print a QTI validation result
## S3 method for class 'qti_validation_result' print(x, ...)## S3 method for class 'qti_validation_result' print(x, ...)
x |
A |
... |
Unused. |
The input object, invisibly.
Designed for inline use in R Markdown, e.g.
`r provide_audio("media/klammer.wav")`.
provide_audio( path, mime = NULL, method = c("object", "audio"), warn_size_mb = 5 )provide_audio( path, mime = NULL, method = c("object", "audio"), warn_size_mb = 5 )
path |
Path to the local audio file. |
mime |
MIME type. If NULL, it is guessed from the extension. |
method |
Rendering method:
|
warn_size_mb |
Warn if file is larger than this many MB. |
The function reads a local audio file, encodes it as Base64, and returns either:
an HTML <object> tag
or an HTML <audio> tag
This makes the final XML/HTML fully self-contained.
knitr_asis object containing embedded audio HTML.
Designed for inline use in R Markdown, e.g.
`r provide_file("attachment.pdf")`.
provide_file( path, label = basename(path), mime = NULL, download = TRUE, warn_size_mb = 5 )provide_file( path, label = basename(path), mime = NULL, download = TRUE, warn_size_mb = 5 )
path |
Path to the local file. |
label |
Text shown to the user. Defaults to the file name. |
mime |
MIME type. If NULL, it is guessed from the extension. |
download |
Logical. If TRUE, adds the HTML download attribute. |
warn_size_mb |
Warn if file is larger than this many MB. |
The function reads a local file, encodes it as Base64, and returns an HTML anchor tag with a data: URI. This allows the file to be embedded directly into the rendered output instead of being referenced externally.
The default HTML5 download attribute requests a download and suggests a
file name. It is accepted by verify_qti(..., schema = "extended"), but is
outside the standard QTI 2.1 schema. Set download = FALSE to omit it; the
browser may then display the resource instead of downloading it, and the
suggested file name is lost. In either case, the target LMS and browser
must support embedded data URIs. Schema validation does not establish this
support.
knitr_asis object with an HTML hyperlink.
Publish a course on LMS
publishCourse(object, course_id)publishCourse(object, course_id)
object |
An S4 object of class |
course_id |
A character string with course id in the LMS. |
Status code of the HTTP request.
This method publishes the course by its course id on Learning Management System (LMS). If no LMS connection object is provided, it attempts to guess the connection using default settings (e.g., environment variables). If the connection cannot be established, an error is thrown.
## S4 method for signature 'missing' publishCourse(object, course_id)## S4 method for signature 'missing' publishCourse(object, course_id)
object |
An S4 object of class |
course_id |
A character string with course id in the LMS. |
Status code of the HTTP request.
Publish a course on LMS Opal
## S4 method for signature 'Opal' publishCourse(object, course_id)## S4 method for signature 'Opal' publishCourse(object, course_id)
object |
An S4 object of class Opal that represents a connection to the LMS. |
course_id |
A character string with course id in the LMS. |
Status code of the HTTP request.
Creates object of QtiContributor-class
qti_contributor( name = Sys.getenv("RQTI_AUTHOR"), role = "author", contribution_date = NULL )qti_contributor( name = Sys.getenv("RQTI_AUTHOR"), role = "author", contribution_date = NULL )
name |
A character string representing the name of the author. |
role |
A character string kind of contribution. Possible values: author, publisher, unknown, initiator, terminator, validator, editor, graphical designer, technical implementer, content provider, technical validator, educational validator, script writer, instructional designer, subject matter expert. Default is "author". |
contribution_date |
A date or character string in |
creator= qti_contributor("Max Mustermann", "technical validator")creator= qti_contributor("Max Mustermann", "technical validator")
Creates object of QtiMetadata-class
qti_metadata( contributor = list(), description = "", rights = Sys.getenv("RQTI_RIGHTS"), version = NA_character_ )qti_metadata( contributor = list(), description = "", rights = Sys.getenv("RQTI_RIGHTS"), version = NA_character_ )
contributor |
A list of objects QtiContributor-type that holds metadata information about the authors. |
description |
A character string providing a textual description of the content of this learning object. |
rights |
A character string describing the intellectual property rights and conditions of use for this learning object. By default it takes value from environment variable 'RQTI_RIGHTS'. |
version |
A character string representing the edition/version of this learning object. |
creator= qti_metadata(qtiContributor("Max Mustermann"), description = "Task description", rights = "This file is Copyright (C) 2024 Max Mustermann, all rights reserved.", version = "1.0")creator= qti_metadata(qtiContributor("Max Mustermann"), description = "Task description", rights = "This file is Copyright (C) 2024 Max Mustermann, all rights reserved.", version = "1.0")
Creates object of QtiContributor-class
qtiContributor( name = Sys.getenv("RQTI_AUTHOR"), role = "author", contribution_date = NULL )qtiContributor( name = Sys.getenv("RQTI_AUTHOR"), role = "author", contribution_date = NULL )
name |
A character string representing the name of the author. |
role |
A character string kind of contribution. Possible values: author, publisher, unknown, initiator, terminator, validator, editor, graphical designer, technical implementer, content provider, technical validator, educational validator, script writer, instructional designer, subject matter expert. Default is "author". |
contribution_date |
A date or character string in |
creator= qtiContributor("Max Mustermann", "technical validator")creator= qtiContributor("Max Mustermann", "technical validator")
This class stores metadata information about contributors.
nameA character string representing the name of the author. By default it takes value from environment variable 'RQTI_AUTHOR'.
roleA character string kind of contribution. Possible values: author, publisher, unknown, initiator, terminator, validator, editor, graphical designer, technical implementer, content provider, technical validator, educational validator, script writer, instructional designer, subject matter expert. Default is "author".
contribution_dateA character string representing date of the contribution. Defaults to the current system date when a contributor is assigned.
Shortcut for the qtijs path of the rqti package local installation.
qtijs_pkg_path()qtijs_pkg_path()
qtijs_pkg_path()qtijs_pkg_path()
Creates object of QtiMetadata-class
qtiMetadata( contributor = list(), description = "", rights = Sys.getenv("RQTI_RIGHTS"), version = NA_character_ )qtiMetadata( contributor = list(), description = "", rights = Sys.getenv("RQTI_RIGHTS"), version = NA_character_ )
contributor |
A list of objects QtiContributor-type that holds metadata information about the authors. |
description |
A character string providing a textual description of the content of this learning object. |
rights |
A character string describing the intellectual property rights and conditions of use for this learning object. By default it takes value from environment variable 'RQTI_RIGHTS'. |
version |
A character string representing the edition/version of this learning object. |
creator= qtiMetadata(qtiContributor("Max Mustermann"), description = "Task description", rights = "This file is Copyright (C) 2024 Max Mustermann, all rights reserved.", version = "1.0")creator= qtiMetadata(qtiContributor("Max Mustermann"), description = "Task description", rights = "This file is Copyright (C) 2024 Max Mustermann, all rights reserved.", version = "1.0")
This class stores metadata information such as contributors, description, rights and version for QTI-compliant tasks or tests.
contributorA list of objects QtiContributor-type that holds metadata information about the authors.
descriptionA character string providing a textual description of the content of this learning object.
rightsA character string describing the intellectual property rights and conditions of use for this learning object. By default it takes value from environment variable 'RQTI_RIGHTS'.
versionA character string representing the edition/version of this learning object.
This method removes a user from a group on the Learning Management System (LMS). If no LMS connection object is provided, it attempts to guess the connection using default settings (e.g., environment variables). If the connection cannot be established, an error is thrown.
This method removes a user from a learning group in LMS Opal by group id and user id.
removeGroupUser(object, group_id, user_id) ## S4 method for signature 'missing' removeGroupUser(object, group_id, user_id) ## S4 method for signature 'Opal' removeGroupUser(object, group_id, user_id)removeGroupUser(object, group_id, user_id) ## S4 method for signature 'missing' removeGroupUser(object, group_id, user_id) ## S4 method for signature 'Opal' removeGroupUser(object, group_id, user_id)
object |
An S4 object of class Opal that represents a connection to the LMS. |
group_id |
A character vector of length one specifying the group ID. |
user_id |
A character vector of length one specifying the user ID. |
Status code of the HTTP request.
Status code 200 if the user was removed successfully, or NULL
when OPAL rejects the request.
removeGroupUser("442662912", "196610") removeGroupUser("442662912", "196610")removeGroupUser("442662912", "196610") removeGroupUser("442662912", "196610")
Render Rmd directly in Opal via API
render_opal(input, ...)render_opal(input, ...)
input |
(the path to the input Rmd document) |
... |
Arguments supplied by the knitting frontend. Named |
Customize knit function in the Rmd file using the following YAML setting
after the word knit knit: rqti::render_opal.
A list with the key, display name, and URL of the resource in Opal.
file <- system.file( "rmarkdown/templates/singlechoice-simple/skeleton/skeleton.Rmd", package='rqti' ) render_opal(file)file <- system.file( "rmarkdown/templates/singlechoice-simple/skeleton/skeleton.Rmd", package='rqti' ) render_opal(file)
Generates the qti xml file via rmd2xml. The xml is copied into the qtijs folder which transforms the xml into HTML. Finally, the HTML is displayed and the user sees a preview of the exercise or test.
render_qtijs( input, preview_feedback = FALSE, qtijs_path = qtijs_pkg_path(), ... )render_qtijs( input, preview_feedback = FALSE, qtijs_path = qtijs_pkg_path(), ... )
input |
The path to the input Rmd/md/xml document or an AssessmentItem, AssessmentTest, AssessmentTestOpal, AssessmentSection object. |
preview_feedback |
A boolean value; optional. Set |
qtijs_path |
The path to the qtijs renderer (qti.js), which will be started with servr::httw and to which xml files will be copied. Default is the QTIJS folder in the R package rqti local installation via the helper qtijs_pkg_path(). |
... |
required for passing arguments when knitting |
Requires a running qtijs server, which can be started with start_server().
The preview is automatically loaded into the RStudio viewer pane if run in RStudio. Alternatively you can just open the browser at the corresponding local server url which is displayed after rendering is finished. Since the function is supposed to be called via the Knit-Button in RStudio, it defaults to the RStudio viewer pane.
Customize knit function in the Rmd file using the following YAML setting
after the word knit knit: rqti::render_qtijs.
An URL of the corresponding local server to display the rendering result.
file <- system.file( "rmarkdown/templates/singlechoice-simple/skeleton/skeleton.Rmd", package='rqti' ) render_qtijs(file)file <- system.file( "rmarkdown/templates/singlechoice-simple/skeleton/skeleton.Rmd", package='rqti' ) render_qtijs(file)
Uses qtijs to render a single xml file in the RStudio viewer pane with a local server.
render_xml(input, qtijs_path = qtijs_pkg_path())render_xml(input, qtijs_path = qtijs_pkg_path())
input |
The path to the input Rmd/md/xml document or an AssessmentItem, AssessmentTest, AssessmentTestOpal, AssessmentSection object. |
qtijs_path |
The path to the qtijs renderer (qti.js), which will be started with servr::httw and to which xml files will be copied. Default is the QTIJS folder in the R package rqti local installation via the helper qtijs_pkg_path(). |
nothing, has side effects
file <- system.file("extdata", "sc1d.xml", package = 'rqti') render_qtijs(file)file <- system.file("extdata", "sc1d.xml", package = 'rqti') render_qtijs(file)
Uses qtijs to render a zipped qti archive in the RStudio viewer pane with a local server.
render_zip(input, qtijs_path = qtijs_pkg_path())render_zip(input, qtijs_path = qtijs_pkg_path())
input |
The path to the input Rmd/md/xml document or an AssessmentItem, AssessmentTest, AssessmentTestOpal, AssessmentSection object. |
qtijs_path |
The path to the qtijs renderer (qti.js), which will be started with servr::httw and to which xml files will be copied. Default is the QTIJS folder in the R package rqti local installation via the helper qtijs_pkg_path(). |
nothing, has side effects
Create XML file for question specification from Rmd (md) description according to qti 2.1 information model
rmd2xml(file, path = getwd(), verification = FALSE)rmd2xml(file, path = getwd(), verification = FALSE)
file |
A string of path to file with markdown description of question. |
path |
A string, optional; a folder to store xml file. Default is working directory. |
verification |
A boolean value, optional; enable validation of the xml
file. Default is |
The path string to the xml file.
## Not run: # creates folder with xml (side effect) rmd2xml("task.Rmd", "target_folder", TRUE) ## End(Not run)## Not run: # creates folder with xml (side effect) rmd2xml("task.Rmd", "target_folder", TRUE) ## End(Not run)
Create zip file with test, that contains one xml question specification generated from Rmd (md) description according to qti 2.1 information model
rmd2zip(file, path = getwd(), verification = FALSE)rmd2zip(file, path = getwd(), verification = FALSE)
file |
A string of path to file with markdown description of question. |
path |
A string, optional; a folder to store xml file. Default is working directory. |
verification |
A boolean value, optional; enable validation of the xml
file. Default is |
The path string to the zip file.
## Not run: # creates folder with zip (side effect) rmd2zip("task.Rmd", "target_folder", TRUE) ## End(Not run)## Not run: # creates folder with zip (side effect) rmd2zip("task.Rmd", "target_folder", TRUE) ## End(Not run)
Create an AssessmentSection rqti-object as part of a test content.
The function accepts rqti tasks and sections directly, as well as task
definitions stored in native rqti Rmd/md files, exams-style Rmd files,
or XML files.
section( content, n_variants = 1L, seed_number = NULL, id = NULL, by = "variants", selection = NULL, title = character(0), time_limits = NA_integer_, visible = TRUE, shuffle = FALSE, max_attempts = NA_integer_, allow_comment = TRUE )section( content, n_variants = 1L, seed_number = NULL, id = NULL, by = "variants", selection = NULL, title = character(0), time_limits = NA_integer_, visible = TRUE, shuffle = FALSE, max_attempts = NA_integer_, allow_comment = TRUE )
content |
A list of Rmd, md, or xml files, or task (AssessmentItem) or
section (AssessmentSection) objects. Supported Rmd/md inputs include native |
n_variants |
An integer value indicating the number of task variants to
create from Rmd files. Default is |
seed_number |
An integer vector, optional, specifying seed numbers to reproduce the result of calculations. |
id |
A character value, optional, serving as the identifier of the assessment section. |
by |
A character with two possible values: "variants" or "files", indicating the type of the test structure. Default is "variants". |
selection |
An integer value, optional, defining how many children of
the section are delivered in the test. Default is |
title |
A character value, optional, representing the title of the
section. If not provided, it defaults to |
time_limits |
An integer value, optional, controlling the amount of time a candidate is allowed for this part of the test. |
visible |
A boolean value, optional, indicating whether the title of
this section is shown in the hierarchy of the test structure. Default is
|
shuffle |
A boolean value, optional, determining whether to randomize the
order in which the assessment items and subsections are initially presented
to the candidate. Default is |
max_attempts |
An integer value, optional, setting the maximum number of attempts allowed for a candidate in this section. |
allow_comment |
A boolean value, optional, allowing candidates to leave
comments on each question of the section. Default is |
An object of class AssessmentSection.
sc <- new("SingleChoice", prompt = "Question", choices = c("A", "B", "C")) es <- new("Essay", prompt = "Question") # Since ready-made S4 "AssessmentItem" objects are taken, in this example a #permanent section consisting of two tasks is created. s <- section(c(sc, es), title = "Section with nonrandomized tasks") # Since Rmd files with randomization of internal variables are taken, #in this example 2 variants are created with a different seed number for each. path <- system.file("rmarkdown/templates/", package='rqti') file1 <- file.path(path, "singlechoice-simple/skeleton/skeleton.Rmd") file2 <- file.path(path, "singlechoice-complex/skeleton/skeleton.Rmd") s <- section(c(file1, file2), n_variants = 2, title = "Section with two variants of tasks")sc <- new("SingleChoice", prompt = "Question", choices = c("A", "B", "C")) es <- new("Essay", prompt = "Question") # Since ready-made S4 "AssessmentItem" objects are taken, in this example a #permanent section consisting of two tasks is created. s <- section(c(sc, es), title = "Section with nonrandomized tasks") # Since Rmd files with randomization of internal variables are taken, #in this example 2 variants are created with a different seed number for each. path <- system.file("rmarkdown/templates/", package='rqti') file1 <- file.path(path, "singlechoice-simple/skeleton/skeleton.Rmd") file2 <- file.path(path, "singlechoice-complex/skeleton/skeleton.Rmd") s <- section(c(file1, file2), n_variants = 2, title = "Section with two variants of tasks")
Saves a password in the operating-system credential store. The service name
is derived automatically from endpoint, so separate OPAL installations do
not require a manually chosen credential ID. Existing credentials stored
under the legacy rqtiopal service remain available as a fallback.
set_opal_credentials(endpoint, api_user, credential_id = NA_character_)set_opal_credentials(endpoint, api_user, credential_id = NA_character_)
endpoint |
A length-one character string containing the OPAL endpoint. |
api_user |
A length-one character string containing the API username. |
credential_id |
An optional explicit credential label. This is normally unnecessary and is retained for custom grouping and backward compatibility. |
The derived keyring service name, invisibly.
Create a scoring specification for singleChoice() or a single-choice
Rmd item. multiple_choice_scoring() documents the separate checkbox models.
The singleChoice() item default remains scoring_scheme = "standard".
This helper defaults to method = "custom" for convenient calls such as
single_choice_scoring(incorrect = -0.2). With no settings it produces
correct/incorrect/omitted coefficients of 1/0/0, matching standard scoring.
single_choice_scoring(method = "custom", ...)single_choice_scoring(method = "custom", ...)
method |
A single-choice method. The default |
... |
Settings for the selected method, expressed as fractions of the
item's |
A named list for the scoring_scheme argument of singleChoice().
It is checked against the item type; passing it to multipleChoice() is
an error. Plain YAML mappings are interpreted in the item's own context.
The same settings can be supplied as a YAML mapping:
scoring_scheme: method: custom correct: 1 incorrect: -0.2 omitted: 0
With points: 2, this awards 2, -0.4, and 0 points. A preset can also be
supplied as a string, for example scoring_scheme: kanzow_05.
The number of options is inferred from the item, not passed to this helper.
Methods 10, 12, 14, 15, 17, 18, and 20 require exactly two options.
Method 21 requires a single true/false statement with two answer options.
Invalid option counts raise errors when an item is constructed or an Rmd
file converted. Method 21 also requires statement_truth immediately.
points scales the published coefficients. Thus methods 4, 7, and 8 can
have a maximum different from points; getPoints() reports the actual
maximum. Negative single-choice credits remain negative, without a zero
floor. Supporting a preset does not recommend it for every assessment.
Only kanzow_21 needs this setting. statement_truth = TRUE means that the
assertion posed to the student is actually true, for example "2 + 2 = 4".
FALSE means it is actually false, for example "2 + 2 = 5". It does not
describe the student's response or the position of the correct option.
For a one-point item, an incorrect response scores -62/38 for a true
assertion and -38/62 for a false assertion. Correct responses score 1;
omissions score 0. Other single-choice methods do not need this setting.
The correct option is still identified by singleChoice(solution = ...).
rqti does not infer truth from option labels, which may be translated or
contain HTML. The author must keep solution and statement_truth consistent.
Published coefficients before multiplication by points:
| Method | Correct | Incorrect | Omitted |
kanzow_01 |
1 | 0 | 0 |
kanzow_02 |
1 | 0 | 1/k |
kanzow_03 |
1 | 1 - 1/k | 0 |
kanzow_04 |
1/(k-1) | 0 | 0 |
kanzow_05 |
1 | -1/(2(k-1)) | 0 |
kanzow_06 |
1 | -1/(k-1) | 0 |
kanzow_07 |
1/(k-1) | -1/(k-1) | 0 |
kanzow_08 |
(k-1)/k | -1/k | 0 |
kanzow_09 |
1 | -1/3 | 0 |
kanzow_10 |
1 | -0.48 | 0 |
kanzow_11 |
1 | -0.5 | 0 |
kanzow_12 |
1 | -0.6 | 0 |
kanzow_13 |
1 | -1 | 0 |
kanzow_14 |
1 | -1 | 0.7 |
kanzow_15 |
1 | -1.1 | 0.7 |
kanzow_16 |
1 | -k/(k-1) | 0 |
kanzow_17 |
1 | -1.5 | 0 |
kanzow_18 |
1 | -1.8 | 0 |
kanzow_19 |
1 | -2/(k-1) | 0 |
kanzow_20 |
1 | -3 | 0 |
kanzow_21 |
1 | -62/38 if true; -38/62 if false | 0 |
Kanzow AF, Schmidt D, Kanzow P (2023). Scoring Single-Response Multiple-Choice Items: Scoping Review and Comparison of Different Scoring Methods. JMIR Medical Education, 9, e44084. doi:10.2196/44084.
singleChoice(), multiple_choice_scoring()
singleChoice(choices = c("A", "B", "C"), points = 2, scoring_scheme = single_choice_scoring(incorrect = -0.2)) singleChoice(prompt = "2 + 2 = 4", choices = c("False", "True"), solution = 2, scoring_scheme = single_choice_scoring("kanzow_21", statement_truth = TRUE))singleChoice(choices = c("A", "B", "C"), points = 2, scoring_scheme = single_choice_scoring(incorrect = -0.2)) singleChoice(prompt = "2 + 2 = 4", choices = c("False", "True"), solution = 2, scoring_scheme = single_choice_scoring("kanzow_21", statement_truth = TRUE))
Create object SingleChoice
singleChoice( identifier = generate_id(), title = identifier, choices, choice_identifiers = paste0("Choice", LETTERS[seq(choices)]), solution = 1, content = list(), prompt = "", points = 1, feedback = list(), orientation = "vertical", shuffle = TRUE, calculator = NA_character_, files = NA_character_, scoring_scheme = "standard" )singleChoice( identifier = generate_id(), title = identifier, choices, choice_identifiers = paste0("Choice", LETTERS[seq(choices)]), solution = 1, content = list(), prompt = "", points = 1, feedback = list(), orientation = "vertical", shuffle = TRUE, calculator = NA_character_, files = NA_character_, scoring_scheme = "standard" )
identifier |
A character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits. |
title |
A character representing the title of the XML file associated with the task. By default, it takes the value of the identifier. |
choices |
A character vector defining a set of answer options in the question. |
choice_identifiers |
A character vector, optional, containing a set of identifiers for answers. By default, identifiers are generated automatically according to the template "ChoiceD", where D is a letter representing the alphabetical order of the answer in the list. |
solution |
A numeric value, optional. Represents the index of the correct answer in the choices slot. By default, the first item in the choices slot is considered the correct answer. Default is 1. |
content |
A character string or a list of character strings to form the text of the question, which may include HTML tags. |
prompt |
An optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "". |
points |
A numeric value, optional, representing the number of points for the entire task. Default is 1. |
feedback |
A list containing feedback messages for candidates. Each element of the list should be an instance of either ModalFeedback, CorrectFeedback, or WrongFeedback class. |
orientation |
A character, determining whether to place answers in vertical or horizontal mode. Possible values:
|
shuffle |
A boolean value indicating whether to randomize the order in
which the choices are initially presented to the candidate. Default is
|
calculator |
A character, optional, determining whether to show a calculator to the candidate. Possible values:
|
files |
A character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam. |
scoring_scheme |
A method name or specification from |
An object of class SingleChoice
sc_min <- singleChoice(prompt = "Question?", choices = c("Answer1", "Answer2", "Answer3")) sc <- singleChoice(identifier = "id_task_1234", title = "Single Choice Task", content = "<p>Pick up the right option</p>", prompt = "Plain text, can be used instead of content", points = 2, feedback = list(new("WrongFeedback", content = list("Wrong answer"))), calculator = "scientific-calculator", files = "text_book.pdf", choices = c("option 1", "option 2", "option 3"), choice_identifiers = c("ChoiceA", "ChoiceB", "ChoiceC"), shuffle = TRUE, orientation = "vertical", solution = 2)sc_min <- singleChoice(prompt = "Question?", choices = c("Answer1", "Answer2", "Answer3")) sc <- singleChoice(identifier = "id_task_1234", title = "Single Choice Task", content = "<p>Pick up the right option</p>", prompt = "Plain text, can be used instead of content", points = 2, feedback = list(new("WrongFeedback", content = list("Wrong answer"))), calculator = "scientific-calculator", files = "text_book.pdf", choices = c("option 1", "option 2", "option 3"), choice_identifiers = c("ChoiceA", "ChoiceB", "ChoiceC"), shuffle = TRUE, orientation = "vertical", solution = 2)
Class SingleChoice is responsible for creating single-choice assessment
tasks according to the QTI 2.1 standard.
identifierA character representing the unique identifier of the assessment task. By default, it is generated as 'id_task_dddd', where dddd represents random digits.
titleA character representing the title of the XML file associated with the task. By default, it takes the value of the identifier.
contentA list of character content to form the text of the question, which can include HTML tags. For tasks of the Entry type, it must also contain at least one instance of Gap objects, such as TextGap, TextGapOpal, NumericGap, or InlineChoice.
promptAn optional character representing a simple question text, consisting of one paragraph. This can supplement or replace content in the task. Default is "".
pointsA numeric value, optional, representing the number of points for the entire task. Default is 1, but pay attention:
For tasks of the Entry type, it is calculated as the sum of the gap points by default.
For tasks of the DirectedPair, the default is calculated as 0.5 points per pair.
For tasks of the MatchTable type, it can also be calculated as the sum of points for individual answers, when provided.
For tasks of the MultipleChoice type, points is numeric vector and
required. Each number in this vector determines the number of points that
will be awarded to a candidate if they select the corresponding answer. The
order of the scores must match the order of the choices. It is possible
to assign negative values to incorrect answers. All answers with a
positive score are considered correct.
feedbackA list containing feedback messages for candidates. Each element of the list should be an instance of either ModalFeedback, CorrectFeedback, or WrongFeedback class.
calculatorA character, optional, determining whether to show a calculator to the candidate. Possible values:
"simple"
"scientific"
filesA character vector, optional, containing paths to files that will be accessible to the candidate during the test/exam.
metadataAn object of class QtiMetadata that holds metadata information about the task.
stylesheet_pathOptional character vector of local CSS file paths. Stylesheets are linked from the item and included in QTI exports. In Rmd YAML, relative paths are resolved against the Rmd file's directory.
cssOptional single character string of CSS text, linked after any
files in stylesheet_path. In Rmd YAML, use a literal block (css: |).
CSS assets referenced by url() or @import are not bundled automatically.
choicesA character vector defining a set of answer options in the question.
choice_identifiersA character vector, optional, containing a set of identifiers for answers. By default, identifiers are generated automatically according to the template "ChoiceD", where D is a letter representing the alphabetical order of the answer in the list.
shuffleA boolean value indicating whether to randomize the order in
which the choices are initially presented to the candidate. Default is
TRUE.
orientationA character, determining whether to place answers in vertical or horizontal mode. Possible values:
"vertical" - Default.
"horizontal"
solutionA numeric value, optional. Represents the index of the correct
answer in the choices slot. By default, the first item in the choices
slot is considered the correct answer. Default is 1.
scoring_schemeA method name or named list from single_choice_scoring().
Defaults to "standard"; "penalty" retains correction for guessing.
sc <- new("SingleChoice", identifier = "id_task_1234", title = "Single Choice Task", content = list("<p>Pick up the right option</p>"), prompt = "Plain text, can be used instead of content", points = 2, feedback = list(new("WrongFeedback", content = list("Wrong answer"))), calculator = "scientific-calculator", files = "text_book.pdf", choices = c("option 1", "option 2", "option 3", "option 4"), choice_identifiers = c("ChoiceA", "ChoiceB", "ChoiceC", "ChoiceD"), shuffle = TRUE, orientation = "vertical", solution = 2)sc <- new("SingleChoice", identifier = "id_task_1234", title = "Single Choice Task", content = list("<p>Pick up the right option</p>"), prompt = "Plain text, can be used instead of content", points = 2, feedback = list(new("WrongFeedback", content = list("Wrong answer"))), calculator = "scientific-calculator", files = "text_book.pdf", choices = c("option 1", "option 2", "option 3", "option 4"), choice_identifiers = c("ChoiceA", "ChoiceB", "ChoiceC", "ChoiceD"), shuffle = TRUE, orientation = "vertical", solution = 2)
This function starts an http server with the qtijs renderer. The renderer performs the conversion of qti.xml into HTML.
start_server(qtijs_path = qtijs_pkg_path(), daemon = T)start_server(qtijs_path = qtijs_pkg_path(), daemon = T)
qtijs_path |
The path to the qtijs renderer (qti.js), which will be started with servr::httw and to which xml files will be copied. Default is the QTIJS folder in the R package rqti local installation via the helper qtijs_pkg_path(). |
daemon |
This parameter is forwarded to |
The server has to be started manually by the user, otherwise the Knit-Button will not work. The Knit-Button starts a new session and invoking a server there does not work. You can automatically start the server via an .RProfile file on start up.
The URL string of the qtijs server.
## Not run: start_server() ## End(Not run)## Not run: start_server() ## End(Not run)
Stop QTIJS local server
stop_server()stop_server()
nothing, has side effects
Create an AssessmentTest rqti-object.
test( content, identifier = "test_identifier", title = "Test Title", time_limit = NULL, max_attempts = 1L, fallback_titles = "generic", academic_grading = NULL, grade_label = c(en = "Grade", de = "Note"), table_label = c(en = "Grade", de = "Note"), navigation_mode = "nonlinear", submission_mode = "individual", allow_comment = TRUE, rebuild_variables = TRUE, stylesheet_path = NULL, contributor = list(), description = "", rights = Sys.getenv("RQTI_RIGHTS"), version = "0.0.9" )test( content, identifier = "test_identifier", title = "Test Title", time_limit = NULL, max_attempts = 1L, fallback_titles = "generic", academic_grading = NULL, grade_label = c(en = "Grade", de = "Note"), table_label = c(en = "Grade", de = "Note"), navigation_mode = "nonlinear", submission_mode = "individual", allow_comment = TRUE, rebuild_variables = TRUE, stylesheet_path = NULL, contributor = list(), description = "", rights = Sys.getenv("RQTI_RIGHTS"), version = "0.0.9" )
content |
A list containing AssessmentSection objects. |
identifier |
A character value indicating the identifier of the test file. Default is 'test_identifier'. |
title |
A character value, optional, representing the file title. Default is 'Test Title'. |
time_limit |
An integer value, optional, controlling the time given to a
candidate for the test in minutes. Default is |
max_attempts |
An integer value, optional, indicating the maximum number of attempts allowed for the candidate. Default is 1. |
fallback_titles |
A character value, optional, controlling how titles are assigned when no explicit title is provided. Possible values are "filename" (use filenames as titles) and "generic" (use generic labels such as "Section 1", "Section 1.2", or "Task 1.2.1"). Default is "generic". |
academic_grading |
A named numeric vector that defines the grade table shown to the candidate as feedback at the end of the test. Each grade corresponds to the minimum percentage score required to achieve it.
A helper function The default is |
grade_label |
A character value, optional; a short message that shows with a grade in the final feedback; for multilingual use, it can be a named vector with two-letter ISO language codes as names (e.g., c(en="Grade", de="Note")); during test creation, it takes the value for the language of the operating system; c(en="Grade", de="Note")is default. |
table_label |
A character value, optional; a concise message to display as the column title of the grading table in the final feedback; for multilingual use, it can be a named vector with two-letter ISO language codes as names (e.g., c(en="Grade", de="Note")); during test creation, it takes the value for the language of the operating system; c(en="Grade", de="Note")is default. |
navigation_mode |
A character value, optional, determining the general paths that the candidate may have during the exam. Two mode options are possible:
|
submission_mode |
A character value, optional, determining when the candidate's responses are submitted for response processing. One of two mode options is possible:
|
allow_comment |
A boolean, optional, allowing the candidate to leave
comments on each question. Default is |
rebuild_variables |
A boolean, optional, enabling the recalculation of
variables and reshuffling the order of choices for each item-attempt.
Default is |
stylesheet_path |
A character value, optional, specifying the path to a
custom CSS stylesheet. If provided, the stylesheet is included at the
assessment test level and applied during rendering. When
|
contributor |
A list of objects QtiContributor-type that holds metadata information about the authors. |
description |
A character string providing a textual description of the content of this learning object. |
rights |
A character string describing the intellectual property rights and conditions of use for this learning object. By default it takes value from environment variable 'RQTI_RIGHTS'. |
version |
A character string representing the edition/version of this learning object. |
An AssessmentTest object.
test4opal(), section(), AssessmentTest, AssessmentSection
sc <- new("SingleChoice", prompt = "Question", choices = c("A", "B", "C")) es <- new("Essay", prompt = "Question") s <- section(c(sc, es), title = "Section with nonrandomized tasks") t <- test(s, title = "Example of the Exam")sc <- new("SingleChoice", prompt = "Question", choices = c("A", "B", "C")) es <- new("Essay", prompt = "Question") s <- section(c(sc, es), title = "Section with nonrandomized tasks") t <- test(s, title = "Example of the Exam")
Create an AssessmentTestOpal rqti-object.
test4opal( content, identifier = "test_identifier", title = "Test Title", time_limit = NULL, max_attempts = 1L, files = NULL, calculator = NULL, fallback_titles = "generic", academic_grading = NULL, grade_label = c(en = "Grade", de = "Note"), table_label = c(en = "Grade", de = "Note"), navigation_mode = "nonlinear", submission_mode = "individual", allow_comment = TRUE, rebuild_variables = TRUE, show_test_time = TRUE, mark_items = TRUE, keep_responses = FALSE, stylesheet_path = NULL, contributor = list(), description = "", rights = Sys.getenv("RQTI_RIGHTS"), version = "0.0.9" )test4opal( content, identifier = "test_identifier", title = "Test Title", time_limit = NULL, max_attempts = 1L, files = NULL, calculator = NULL, fallback_titles = "generic", academic_grading = NULL, grade_label = c(en = "Grade", de = "Note"), table_label = c(en = "Grade", de = "Note"), navigation_mode = "nonlinear", submission_mode = "individual", allow_comment = TRUE, rebuild_variables = TRUE, show_test_time = TRUE, mark_items = TRUE, keep_responses = FALSE, stylesheet_path = NULL, contributor = list(), description = "", rights = Sys.getenv("RQTI_RIGHTS"), version = "0.0.9" )
content |
A list containing AssessmentSection objects. |
identifier |
A character value indicating the identifier of the test file. Default is 'test_identifier'. |
title |
A character value, optional, representing the file title. Default is 'Test Title'. |
time_limit |
An integer value, optional, controlling the time given to a
candidate for the test in minutes. Default is |
max_attempts |
An integer value, optional, indicating the maximum number of attempts allowed for the candidate. Default is 1. |
files |
A character vector, optional; paths to files that will be accessible to the candidate during the test/exam. |
calculator |
A character, optional; determines whether to show a calculator to the candidate. Possible values:
|
fallback_titles |
A character value, optional, controlling how titles are assigned when no explicit title is provided. Possible values are "filename" (use filenames as titles) and "generic" (use generic labels such as "Section 1", "Section 1.2", or "Task 1.2.1"). Default is "generic". |
academic_grading |
A named numeric vector that defines the grade table shown to the candidate as feedback at the end of the test. Each grade corresponds to the minimum percentage score required to achieve it.
A helper function The default is |
grade_label |
A character value, optional; a short message that shows with a grade in the final feedback; for multilingual use, it can be a named vector with two-letter ISO language codes as names (e.g., c(en="Grade", de="Note")); during test creation, it takes the value for the language of the operating system; c(en="Grade", de="Note")is default. |
table_label |
A character value, optional; a concise message to display as the column title of the grading table in the final feedback; for multilingual use, it can be a named vector with two-letter ISO language codes as names (e.g., c(en="Grade", de="Note")); during test creation, it takes the value for the language of the operating system; c(en="Grade", de="Note")is default. |
navigation_mode |
A character value, optional, determining the general paths that the candidate may have during the exam. Two mode options are possible:
|
submission_mode |
A character value, optional, determining when the candidate's responses are submitted for response processing. One of two mode options is possible:
|
allow_comment |
A boolean, optional, allowing the candidate to leave
comments on each question. Default is |
rebuild_variables |
A boolean, optional, enabling the recalculation of
variables and reshuffling the order of choices for each item-attempt.
Default is |
show_test_time |
A boolean, optional, determining whether to show
the candidate's elapsed processing time without a time limit. Default is |
mark_items |
A boolean, optional, determining whether to allow
candidates to mark questions. Default is |
keep_responses |
A boolean, optional, determining whether to save the
the candidate's answers from the previous attempt. Default is |
stylesheet_path |
A character value, optional, specifying the path to a
custom CSS stylesheet. If provided, the stylesheet is included at the
assessment test level and applied during rendering. When
|
contributor |
A list of objects QtiContributor-type that holds metadata information about the authors. |
description |
A character string providing a textual description of the content of this learning object. |
rights |
A character string describing the intellectual property rights and conditions of use for this learning object. By default it takes value from environment variable 'RQTI_RIGHTS'. |
version |
A character string representing the edition/version of this learning object. |
An AssessmentTestOpal object
test(), section(),
AssessmentTestOpal, AssessmentSection
sc <- new("SingleChoice", prompt = "Question", choices = c("A", "B", "C")) es <- new("Essay", prompt = "Question") s <- section(c(sc, es), title = "Section with nonrandomized tasks") t <- test4opal(s, title = "Example of the Exam", show_test_time = FALSE)sc <- new("SingleChoice", prompt = "Question", choices = c("A", "B", "C")) es <- new("Essay", prompt = "Question") s <- section(c(sc, es), title = "Section with nonrandomized tasks") t <- test4opal(s, title = "Example of the Exam", show_test_time = FALSE)
Create object TextGap
textGap( solution, response_identifier = generate_id(type = "gap"), points = 1, placeholder = "", expected_length = size_gap(solution), case_sensitive = FALSE ) gapText( solution, response_identifier = generate_id(type = "gap"), points = 1, placeholder = "", expected_length = size_gap(solution), case_sensitive = FALSE )textGap( solution, response_identifier = generate_id(type = "gap"), points = 1, placeholder = "", expected_length = size_gap(solution), case_sensitive = FALSE ) gapText( solution, response_identifier = generate_id(type = "gap"), points = 1, placeholder = "", expected_length = size_gap(solution), case_sensitive = FALSE )
solution |
A character vector containing the values considered as correct answers. |
response_identifier |
A character value representing an identifier for the answer. By default, it is generated as 'id_gap_dddd', where dddd represents random digits. |
points |
A numeric value, optional, representing the number of points for this gap. Default is 1 |
placeholder |
A character value, optional, used to place helpful text in the text input field in the content delivery engine. Default is "". |
expected_length |
A numeric value, optional, used to set the size of the text input field in the content delivery engine. Default value is adjusted by solution size. |
case_sensitive |
A boolean value, determining whether the evaluation of
the correct answer is case sensitive. Default is |
An object of class TextGap
[entry()][numericGap()][textGapOpal()]
tg_min <- textGap("answer") tg <- textGap(solution = "answer", response_identifier = "id_gap_1234", points = 2, placeholder = "put your answer here", expected_length = 20, case_sensitive = TRUE)tg_min <- textGap("answer") tg <- textGap(solution = "answer", response_identifier = "id_gap_1234", points = 2, placeholder = "put your answer here", expected_length = 20, case_sensitive = TRUE)
Class TextGap is responsible for creating instances of input
fields with text type of answers in question Entry type assessment tasks
according to the QTI 2.1 standard.
response_identifierA character value representing an identifier for the answer. By default, it is generated as 'id_gap_dddd', where dddd represents random digits.
pointsA numeric value, optional, representing the number of points for
this gap. Default is 1.
placeholderA character value, optional, used to place helpful text in the text input field in the content delivery engine.
expected_lengthA numeric value, optional, used to set the size of the text input field in the content delivery engine.
solutionA character vector containing the values considered as correct answers.
case_sensitiveA boolean value, determining whether the evaluation of
the correct answer is case sensitive. Default is FALSE.
Entry, NumericGap, TextGapOpal and InlineChoice.
tg <- new("TextGap", response_identifier = "id_gap_1234", points = 2, placeholder = "do not put special characters", expected_length = 20, solution = c("answer", "answerr", "aanswer"), case_sensitive = FALSE)tg <- new("TextGap", response_identifier = "id_gap_1234", points = 2, placeholder = "do not put special characters", expected_length = 20, solution = c("answer", "answerr", "aanswer"), case_sensitive = FALSE)
Create object TextGapOpal
textGapOpal( solution, response_identifier = generate_id(type = "gap"), points = 1, placeholder = "", expected_length = size_gap(solution), case_sensitive = FALSE, tolerance = 0 ) gapTextOpal( solution, response_identifier = generate_id(type = "gap"), points = 1, placeholder = "", expected_length = size_gap(solution), case_sensitive = FALSE, tolerance = 0 )textGapOpal( solution, response_identifier = generate_id(type = "gap"), points = 1, placeholder = "", expected_length = size_gap(solution), case_sensitive = FALSE, tolerance = 0 ) gapTextOpal( solution, response_identifier = generate_id(type = "gap"), points = 1, placeholder = "", expected_length = size_gap(solution), case_sensitive = FALSE, tolerance = 0 )
solution |
A character vector containing the values considered as correct answers. |
response_identifier |
A character value representing an identifier for the answer. By default, it is generated as 'id_gap_dddd', where dddd represents random digits. |
points |
A numeric value, optional, representing the number of points for this gap. Default is 1 |
placeholder |
A character value, optional, used to place helpful text in the text input field in the content delivery engine. Default is "". |
expected_length |
A numeric value, optional, used to set the size of the text input field in the content delivery engine. Default value is adjusted by solution size. |
case_sensitive |
A boolean value, determining whether the evaluation of
the correct answer is case sensitive. Default is |
tolerance |
A numeric value defining how many characters will be taken into account to tolerate spelling mistakes in the evaluation of candidate answers. Default is 0. |
An object of class TextGapOpal
[entry()][numericGap()][textGap()]
tgo_min <- textGapOpal("answer") tgo <- textGapOpal(solution = "answer", response_identifier = "id_gap_1234", points = 2, placeholder = "put your answer here", expected_length = 20, case_sensitive = TRUE, tolerance = 2)tgo_min <- textGapOpal("answer") tgo <- textGapOpal(solution = "answer", response_identifier = "id_gap_1234", points = 2, placeholder = "put your answer here", expected_length = 20, case_sensitive = TRUE, tolerance = 2)
Class TextGapOpal is responsible for creating instances of input fields
with text type of answers in question Entry type assessment tasks according
to the QTI 2.1 standard for LMS Opal.
response_identifierA character value representing an identifier for the answer. By default, it is generated as 'id_gap_dddd', where dddd represents random digits.
pointsA numeric value, optional, representing the number of points for
this gap. Default is 1.
placeholderA character value, optional, used to place helpful text in the text input field in the content delivery engine.
expected_lengthA numeric value, optional, used to set the size of the text input field in the content delivery engine.
solutionA character vector containing the values considered as correct answers.
case_sensitiveA boolean value, determining whether the evaluation of
the correct answer is case sensitive. Default is FALSE.
toleranceA numeric value defining how many characters will be taken
into account to tolerate spelling mistakes in the evaluation of candidate
answers. Default is 0.
Entry, NumericGap, TextGap and InlineChoice.
tgo <- new("TextGapOpal", response_identifier = "id_gap_1234", points = 2, placeholder = "do not put special characters", expected_length = 20, solution = "answer", case_sensitive = FALSE, tolerance = 1)tgo <- new("TextGapOpal", response_identifier = "id_gap_1234", points = 2, placeholder = "do not put special characters", expected_length = 20, solution = "answer", case_sensitive = FALSE, tolerance = 1)
Update the referenced learning resource of a course element in the LMS
updateCourseElementResource(object, course_id, ...)updateCourseElementResource(object, course_id, ...)
object |
An S4 object of class LMS that represents a connection to the LMS. |
course_id |
A character string with course id in the LMS. |
... |
Additional arguments to be passed to the method, if applicable. |
Response of the HTTP request.
This method updates the learning resource by its course id on Learning Management System (LMS). If no LMS connection object is provided, it attempts to guess the connection using default settings (e.g., environment variables). If the connection cannot be established, an error is thrown.
## S4 method for signature 'missing' updateCourseElementResource(object, course_id, ...)## S4 method for signature 'missing' updateCourseElementResource(object, course_id, ...)
object |
An S4 object of class LMS that represents a connection to the LMS. |
course_id |
A character string with course id in the LMS. |
... |
Additional arguments to be passed to the method, if applicable. |
Response of the HTTP request.
Update the referenced learning resource of a course element in the LMS Opal
## S4 method for signature 'Opal' updateCourseElementResource( object, course_id, node_id, resource_id, publish = TRUE )## S4 method for signature 'Opal' updateCourseElementResource( object, course_id, node_id, resource_id, publish = TRUE )
object |
An S4 object of class LMS that represents a connection to the LMS. |
course_id |
A character string with the course ID. You can find this in the course's details (Resource ID) in the LMS. |
node_id |
A character string with the course element ID. This can be found, for example, in the course editor under the "Title and Description" tab of the respective course element in the LMS Opal. |
resource_id |
A character string with the ID of the resource. This can be found in the details view of the desired resource within the LMS. |
publish |
A boolean value that determines whether the course should be
published after the resource is updated. If |
The response of the HTTP request made to update the resource. If the course is published, an additional message about the publishing status is returned.
This is a generic function that handles the process of uploading content to
a Learning Management System (LMS). The content can be in the form of an
AssessmentTest, AssessmentTestOpal, AssessmentItem object, or a file in
Rmd, Markdown, zip or XML format.
This is a method that handles the process of uploading content to
a Learning Management System (LMS). The content can be in the form of an
AssessmentTest, AssessmentTestOpal, AssessmentItem object, or a file in
Rmd, Markdown, zip or XML format.
This is a generic function that handles the process of uploading content to
LMS Opal. The content can be in the form of an AssessmentTest,
AssessmentTestOpal, AssessmentItem object, or a file in Rmd, Markdown,
zip or XML format.
upload2LMS(object, test, ...) ## S4 method for signature 'LMS' upload2LMS(object, test, ...) ## S4 method for signature 'Opal' upload2LMS( object, test, display_name = NULL, access = 4, overwrite = TRUE, open_in_browser = TRUE, as_survey = FALSE )upload2LMS(object, test, ...) ## S4 method for signature 'LMS' upload2LMS(object, test, ...) ## S4 method for signature 'Opal' upload2LMS( object, test, display_name = NULL, access = 4, overwrite = TRUE, open_in_browser = TRUE, as_survey = FALSE )
object |
An S4 object representing the LMS, such as an instance of the Opal class. |
test |
An AssessmentTest, AssessmentTestOpal or AssessmentItem objects, or a character string with path to Rmd/md, zip or XML files. |
... |
Additional arguments to be passed to the method, if applicable. |
display_name |
A length-one character vector naming the resource in OPAL; by default, this is the file name without extension or the object identifier; optional. |
access |
An integer value, optional; it controls publication status, where 1 - only those responsible for this learning resource; 2 - responsible and other authors; 3 - all registered users; 4 - registered users and guests. Default is 4. |
overwrite |
A boolean value. If |
open_in_browser |
A boolean value, optional; controls whether to open
a URL in the default browser. Default is |
as_survey |
A boolean value, optional. If |
Function upload2opal() takes full prepared zip archive of QTI-test or
QTI-task and uploads it to the OPAL.
upload2opal( test, display_name = NULL, access = 4, overwrite = TRUE, endpoint = NULL, open_in_browser = TRUE, as_survey = FALSE, api_user = NULL, credential_id = NULL )upload2opal( test, display_name = NULL, access = 4, overwrite = TRUE, endpoint = NULL, open_in_browser = TRUE, as_survey = FALSE, api_user = NULL, credential_id = NULL )
test |
A length one character vector of AssessmentTest, AssessmentTestOpal or AssessmentItem objects, Rmd/md or XML files; required. |
display_name |
A length-one character vector naming the file in OPAL; by default, this is the file name without extension; optional. |
access |
An integer value, optional; it controls publication status, where 1 - only those responsible for this learning resource; 2 - responsible and other authors; 3 - all registered users; 4 - registered users and guests. Default is 4. |
overwrite |
A boolean value; if |
endpoint |
A string containing the OPAL LMS endpoint; by default, it is read from
environment variable |
open_in_browser |
A boolean value, optional; controls whether to open
a URL in the default browser. Default is |
as_survey |
A boolean value, optional; controls the resource type (test
or survey). Default is |
api_user |
A character value of the username in the OPAL. |
credential_id |
An optional name for the credential set. If omitted, the
credential service is derived from |
A list with the key, display name, and URL of the resource in Opal.
file <- system.file( "rmarkdown/templates/singlechoice-simple/skeleton/skeleton.Rmd", package='rqti' ) upload2opal(file, "task 1", open_in_browser = FALSE)file <- system.file( "rmarkdown/templates/singlechoice-simple/skeleton/skeleton.Rmd", package='rqti' ) upload2opal(file, "task 1", open_in_browser = FALSE)
S4 generic for validating QTI documents in various formats.
verify_qti( doc, extended_schema = FALSE, ctx = 40, color = TRUE, engine = c("auto", "xml2", "xmllint"), ignore_import = TRUE, print = TRUE, schema = NULL ) ## S4 method for signature 'character' verify_qti( doc, extended_schema = FALSE, ctx = 40, color = TRUE, engine = c("auto", "xml2", "xmllint"), ignore_import = TRUE, print = TRUE, schema = NULL ) ## S4 method for signature 'xml_document' verify_qti( doc, extended_schema = FALSE, ctx = 40, color = TRUE, engine = c("auto", "xml2", "xmllint"), ignore_import = TRUE, print = TRUE, schema = NULL ) ## S4 method for signature 'AssessmentItem' verify_qti( doc, extended_schema = FALSE, ctx = 40, color = TRUE, engine = c("auto", "xml2", "xmllint"), ignore_import = TRUE, print = TRUE, schema = NULL ) ## S4 method for signature 'AssessmentTest' verify_qti( doc, extended_schema = FALSE, ctx = 40, color = TRUE, engine = c("auto", "xml2", "xmllint"), ignore_import = TRUE, print = TRUE, schema = NULL )verify_qti( doc, extended_schema = FALSE, ctx = 40, color = TRUE, engine = c("auto", "xml2", "xmllint"), ignore_import = TRUE, print = TRUE, schema = NULL ) ## S4 method for signature 'character' verify_qti( doc, extended_schema = FALSE, ctx = 40, color = TRUE, engine = c("auto", "xml2", "xmllint"), ignore_import = TRUE, print = TRUE, schema = NULL ) ## S4 method for signature 'xml_document' verify_qti( doc, extended_schema = FALSE, ctx = 40, color = TRUE, engine = c("auto", "xml2", "xmllint"), ignore_import = TRUE, print = TRUE, schema = NULL ) ## S4 method for signature 'AssessmentItem' verify_qti( doc, extended_schema = FALSE, ctx = 40, color = TRUE, engine = c("auto", "xml2", "xmllint"), ignore_import = TRUE, print = TRUE, schema = NULL ) ## S4 method for signature 'AssessmentTest' verify_qti( doc, extended_schema = FALSE, ctx = 40, color = TRUE, engine = c("auto", "xml2", "xmllint"), ignore_import = TRUE, print = TRUE, schema = NULL )
doc |
A QTI document (file path, character string, xml_document, or S4 object) |
extended_schema |
Logical. Use extended rqti schema? |
ctx |
Integer. Context characters for error snippets. |
color |
Logical. Use ANSI colors? |
engine |
Character. Validation backend ("auto", "xml2", "xmllint"). |
ignore_import |
Logical. Ignore import warnings? |
print |
Logical. Print results? |
schema |
Character string or |
A qti_validation_result or qti_validation_results_list object.
verify_qti(character): Validate character input (file path or XML string)
verify_qti(xml_document): Validate xml_document objects
verify_qti(AssessmentItem): Validate assessmentItem objects
verify_qti(AssessmentTest): Validate assessmentTest objects
Validates an XML document against the QTI schema or the extended rqti QTI
schema. Input can be either a file path, a character string containing XML,
or an xml2::xml_document.
verify_qti_impl( doc, extended_schema = FALSE, ctx = 40, color = TRUE, engine = c("auto", "xml2", "xmllint"), ignore_import = TRUE, print = TRUE, schema = NULL )verify_qti_impl( doc, extended_schema = FALSE, ctx = 40, color = TRUE, engine = c("auto", "xml2", "xmllint"), ignore_import = TRUE, print = TRUE, schema = NULL )
doc |
A QTI XML document. This can be a file path, a character string
containing XML, or an |
extended_schema |
Logical. Should the extended rqti schema be used?
Defaults to |
ctx |
Integer. Number of characters of context shown before and after
the offending XML element in printed snippets. Defaults to |
color |
Logical. Should ANSI colors be used in printed output? Defaults
to |
engine |
Character string specifying the validation backend. One of
|
ignore_import |
Logical. If |
print |
Logical. Should the validation result be printed before it is
returned? Defaults to |
schema |
Character string or |
By default, the function chooses a validation backend automatically. If
xmllint is available, the input is a file path, and the platform is not
Windows, the xmllint backend is used. Otherwise, validation falls back to
xml2.
The function returns an object of class "qti_validation_result". By
default, that object is also printed in a human-readable form.
An object of class "qti_validation_result" with components:
Logical scalar.
A list of parsed validation errors.
The backend used for validation.
## Not run: f <- system.file("extdata", "sc1d.xml", package = "rqti") res <- verify_qti(f) res$valid x <- xml2::read_xml(f) res2 <- verify_qti(x) summary(res2) ## End(Not run)## Not run: f <- system.file("extdata", "sc1d.xml", package = "rqti") res <- verify_qti(f) res$valid x <- xml2::read_xml(f) res2 <- verify_qti(x) summary(res2) ## End(Not run)
Create object WrongFeedback
wrongFeedback(content = list(), title = character(0), show = TRUE)wrongFeedback(content = list(), title = character(0), show = TRUE)
content |
A character string or a list of character strings to form the text of the question, which may include HTML tags. |
title |
A character value, optional, representing the title of the feedback window. |
show |
A boolean value, optional, determining whether to show ( |
An object of class WrongFeedback
wfb <- wrongFeedback(content = "Some comments", title = "Feedback")wfb <- wrongFeedback(content = "Some comments", title = "Feedback")
Class WrongFeedback is responsible for delivering feedback messages
to the candidate in case of an incorrect answer on the entire exercise.
outcome_identifierA character representing the unique identifier of the outcome declaration variable that relates to feedback. Default is "FEEDBACKMODAL".
showA boolean value, optional, determining whether to show (TRUE) or
hide (FALSE) the modal feedback. Default is TRUE.
titleA character value, optional, representing the title of the modal feedback window.
contentA list of character content to form the text of the modal feedback, which can include HTML tags.
identifierA character value representing the identifier of the modal feedback item. Default is "incorrect".
wfb <- new("WrongFeedback", title = "Wrong answer", content = list("<b>Some demonstration</b>"))wfb <- new("WrongFeedback", title = "Wrong answer", content = list("<b>Some demonstration</b>"))