define_exercises_from_excel | R Documentation |
Each row in the Excel file is interpreted as an exercise. We only need to define the columns that we are going to use; the rest of the columns are taken by default.
define_exercises_from_excel(ex, file, sheet_index, sheet_name)
## S3 method for class 'exam'
define_exercises_from_excel(ex, file, sheet_index = NULL, sheet_name = NULL)
ex |
An 'exam' object. |
file |
A string, name of an Excel file. |
sheet_index |
A number, sheet index in the workbook. |
sheet_name |
A string, sheet name. |
In addition to the file, we can indicate the sheet by its name or index. If we do not indicate anything, it considers the first sheet.
Both the answer and the options are formed by a vector of strings, from which one is chosen to formulate the exercise and select the answer. To represent a vector of strings in a cell, the function 'vector_to_string()' is used, which includes a separator ("<|>") between the vector elements to generate a string.
An 'exam'.
exam
, vector_to_string
Other exercise definition:
define_an_exercise()
,
define_exercises()
,
define_exercises_from_csv()
rmd <- system.file("extdata/template01.Rmd", package = "rexer")
exercises <- system.file("extdata/exercises.xlsx", package = "rexer")
ex <- exam(
rmd = rmd,
examinees = NULL,
instances_num = 10,
random = TRUE,
reorder_exercises = TRUE,
select_n_exercises = NULL
) |>
define_exercises_from_excel(exercises)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.