Search code examples
r-exams

Changing the default punctuation of the questions in `exams2moodle()` function


I would like to generate a bunch of exams with schoice questions using the exams2moodle() function. Each question will have 4 alternative answers with one and only one TRUE answer. That's pretty normal but I would like to change the deafult behaviour for the marks. The usual behaviour is that you get 100% if you select the right answer and -33% if you select one of the 3 bad answers, but I would like to change this to 100% but -25%. It's that possible? Thanks


Solution

  • This is not officially supported. Note that the reason for the default negative points of 1/#false is that then random guessing has an expectation of 0. Your suggestion would still have a slightly positive expectation.

    For exams2moodle() (but not for all other interfaces) one can use a somewhat hacky workarund:

    ee <- exams_eval()
    ee$pointvec <- function(correct) {
      if(is.logical(correct)) correct <- paste(as.integer(correct), collapse = "")
      c(pos = 1, neg = -1/nchar(correct))
    }
    

    This yields:

    ee$pointvec("1000")
    ##  pos   neg 
    ## 1.00 -0.25 
    

    And in case of exams2moodle() the $pointvec is the only part of the evaluation strategy that is used. Hence, you can then do:

    exams2moodle(..., schoice = list(eval = ee))
    

    leading to the desired behavior.