Test: Compare the column col of the matrix or data.frame df with either the values from the given solutions or with the result of an expression that is evaluated in the students solution

check.col(
  df,
  col,
  expr = NULL,
  class.df = c("data.frame", "data.table", "matrix"),
  check.all = FALSE,
  exists = check.all,
  length = check.all,
  class = check.all,
  values = check.all,
  tol = .Machine$double.eps^0.5,
  failure.exists = "{{df}} does not have a column {{col}}.",
 
    failure.length = "{{df}} has {{length_stud}} rows but it shall have {{length_sol}} rows.",
 
    failure.class = "Column {{col}} of {{df}} has a wrong class. It should be {{class_sol}} but it is {{class_stud}}.",
  failure.values = "Column {{col}} of {{df}} has wrong values.",
  failure.message.add = NULL,
  success.message = "Great, column {{col}} of {{df}} has correct {{tests}}.",
  part = NULL,
  ps = get.ps(),
  stud.env = ps$stud.env,
  verbose = FALSE,
  unsubst.expr = NULL,
  str.expr = NULL
)

Arguments

df

name of the data frame or matrix

col

name of the column

expr

the test expression that will be evaluated

exists

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

failure.exists

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