check_function_result: Check the result of a function call/operation

check_function_resultR Documentation

Check the result of a function call/operation

Description

Check the result of a function call/operation

Usage

## S3 method for class 'OperationState'
check_result(state, error_msg = NULL,
  append = TRUE, ...)

## S3 method for class 'FunctionState'
check_result(state, error_msg = NULL,
  append = TRUE, ...)

## S3 method for class 'FunctionResultState'
check_equal(state,
  eq_condition = "equivalent", eq_fun = NULL, incorrect_msg = NULL,
  append = TRUE, ...)

## S3 method for class 'OperationResultState'
check_equal(state,
  eq_condition = "equivalent", eq_fun = NULL, incorrect_msg = NULL,
  append = TRUE, ...)

Arguments

state

the state to start from (for check_ functions)

error_msg

feedback message in case the student function call at the mentioned index generated an error.

append

Whether or not to append the feedback to feedback built in previous states

...

S3 stuff

eq_condition

character string indicating how to compare. See is_equal.

eq_fun

optional argument to specify a custom equality function. The function should take two arguments and always return a single boolean value: TRUE or FALSE.

incorrect_msg

feedback message in case the evaluation was not the same as in the solution.

Examples

## Not run: 
# Example 1
mean(1:3)

# SCT
ex() %>% check_function("mean") %>% check_result() %>% check_equal()

## End(Not run)

datacamp/testwhat documentation built on June 26, 2022, 9:07 a.m.