check.assign: Checks an assignment to a variable

Description Usage Arguments

View source: R/chunk_tests.r

Description

By default a solution is considered correct if the assignment yields the same value than the sample solution, or has the same rhs (e.g. a call runif(1,0,1)), even if the value differs.

Usage

1
2
3
4
5
6
7
check.assign(call, check.arg.by.value = TRUE, allow.extra.arg = FALSE,
  ignore.arg = NULL, success.message = NULL, failure.message = NULL,
  no.command.failure.message = "You have not yet included correctly, all required R commands in your code...",
  ok.if.same.val = TRUE, call.object = NULL, s3.method = NULL,
  ps = get.ps(), stud.env = ps$stud.env, part = ps$part,
  stud.expr.li = ps$stud.expr.li, verbose = FALSE,
  only.check.assign.exists = FALSE, noeval = isTRUE(ps$noeval), ...)

Arguments

call

the correct assignment that shall be checked (not a quoted call)

allow.extra.arg

if TRUE (not default) the student is allowed to supply additional arguments to the call that were not in the solution. Useful, e.g. if the student shall plot something and is allowed to customize her plot with additional arguments.

ignore.arg

a vector of argument names that will be ignored when checking correctness

ok.if.same.val

if TRUE (not default) the call will be considered as correct, if it yields the same resulting value as the solution, even if its arguments differ.

call.object

alternatively to call a quoted call (call object)

only.check.assign.exists

if TRUE (default = FALSE) only check if an assignemnt to the lhs variable exists no matter whether the assignment is correct. May be sensible if there are additional tests specified afterwards that check some characteristics of the assigned variable.


skranz/RTutor2 documentation built on Oct. 7, 2017, 2:52 p.m.