Checks a function written by the student

check.function(
  code,
  ...,
  check.args = TRUE,
  check.defaults = FALSE,
  check.args.order = TRUE,
  allow.extra.arg = TRUE,
  ps = get.ps(),
  stud.env = ps$stud.env,
  verbose = FALSE,
  part = NULL
)

Arguments

code

code of the form fun_name = function(x,y) #body of function. It is important to wrap the code in and to assign the function name with = (don't use <-). See example below.

...

you can add several test calls to the function. It will be checked whether the users' function returns the same values in those calls than the function in the solution. You can also have a code block wrapped in that ends with a call to the function. In this way you can e.g. specify a random seeds before calling the function.

check.args

if TRUE check the arguments of the user function. If a character vector only check the given arguments.

check.defaults

TRUE = check the default values of the arguments of the user function. If a character vector only check the default values of the given arguments.

check.args.order

if TRUE make sure that the checked arguments appear in the same order in the user function than in the solution

allow.extra.arg

if TRUE the user function can have additional arguments (at the end) that are not in the solution