grade_this_table | R Documentation |
Automatically grade a table resulting from student code using
gradethis::grade_this()
and tbl_grade()
to compare the
student's result with the author's solution.
grade_this_table( correct = NULL, pre_check = NULL, post_check = NULL, pass_if_equal = FALSE, ..., max_diffs = 3, cols = NULL, check_class = TRUE, ignore_class = NULL, check_names = TRUE, check_column_order = FALSE, check_dimensions = TRUE, check_groups = TRUE, check_columns = TRUE, check_column_class = check_columns, check_column_levels = check_columns, check_column_values = check_columns, tolerance = sqrt(.Machine$double.eps), check_row_order = check_columns, hint = getOption("gradethis.fail.hint", FALSE), encourage = getOption("gradethis.fail.encourage", FALSE), pass.praise = NULL )
correct |
|
pre_check, post_check |
|
pass_if_equal |
|
... |
Additional arguments passed to |
max_diffs |
|
cols |
[ |
check_class |
|
ignore_class |
If an element is named, differences will only be ignored between the pair
of the element and its name.
For example, If all the classes of |
check_names |
|
check_column_order |
|
check_dimensions |
|
check_groups |
|
check_columns |
|
check_column_class |
|
check_column_levels |
|
check_column_values |
|
tolerance |
|
check_row_order |
|
hint |
Include a code feedback hint with the failing message? This
argument only applies to |
encourage |
Include a random encouraging phrase with
|
pass.praise |
Logical |
The returned feedback is equivalent to gradethis grading code
using grade_this()
with the following
components:
First the pre_check
code, if any, is evaluated. If this code calls
pass()
, fail()
, or their
equivalents, that feedback is provided immediately.
If pass_if_equal
is TRUE
, then
pass_if_equal()
is called to compare the
.result
to the
.solution
. The message in correct
is used for the feedback.
The appropriate tblcheck grading function is called, returning any feedback:
grade_this_table()
returns the results from tbl_grade()
grade_this_vector()
returns the results from vec_grade()
The post_check
code, if any, is evaluated and any feedback from a call
to pass()
, fail()
, or
their equivalents is returned.
Finally, if no other feedback is returned, the feedback from
gradethis::fail()
is provided to the student, using the options
fail.message
, fail.hint
and fail.encourage
.
tbl_grade()
Other graders:
grade_this_vector()
ex <- gradethis::mock_this_exercise( .solution_code = tibble::tibble(x = 1:3, y = letters[x]), .user_code = tibble::tibble(x = 1:3, y = c("A", "b", "c")) ) ## Grading Tables ---- grade_this_table()(ex) # Roughly equivalent to... gradethis::grade_this({ gradethis::pass_if_equal() tbl_grade() gradethis::fail() })(ex)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.