Test: Check whether a variable is equal to a specified expression

check.variable(var, expr, length = check.all, dim = check.all,
  class = check.all, values = check.all, check.all = TRUE, ...,
  tol = .Machine$double.eps^0.5,
  failure.exists = "You have not yet generated the variable {{var}}.",
  failure.length = "Your variable {{var}} has length {{length_stud}} but it shall have length {{length_sol}}.",
  failure.dim = "Your variable {{var}} has the wrong dimensions (rows x columns).",
  failure.class = "Your variable {{var}} has a wrong class. It should be {{class_sol}} but it is {{class_stud}}.",
  failure.values = "Your variable {{var}} has wrong values.",
  success.message = "Great, {{var}} has correct {{tests}}.", ps = get.ps(),
  stud.env = ps$stud.env, verbose = FALSE, part = NULL)

Arguments

var

a the variable name as string

expr

an expression that will be evaluated in the student environment and returns the variable

length

shall length be checked (similar dim, class, values)

failure.length

a message that is shown if the variable does not exists (similar the other failure.??? variables)

failure.message.add

a text that will be added to all failure messages