Search code examples
rr-examsblackboard

How to score questions with a non-integer number with exams2blackboard


I want to score each question with 0.5 points, but on execution:

exams2blackboard("VAEspVarianzaDesvOP2", n=3, points= 0.5, mchoice = list(enumerate = FALSE), converter = "pandoc", eval = list(partial = T, negative = -1, rule = "false")) 

The error is as follows:

Error en sprintf("%d.0", sum(points)): invalid format '%d'; use format %f, %e, %g or %a for numeric objects

enter image description here


Solution

  • Disclaimer: I'm not sure whether Blackboard Learn and/or Blackboard Ultra can actually deal with fractional points but I cannot test this myself. So for the moment I have replace the sprintf("%d.0", sum(points)) with sprintf("%.3f", sum(points)) which rounds floats to three decimal places.

    Example: To try this out, please use the current development version from R-universe (our usual development server, R-Forge, currently hangs) and try your example above. Or instead use one of the built-in exercises:

    install.packages("exams", repos = "https://zeileis.R-universe.dev")
    library("exams")
    exams2blackboard("deriv2.Rmd", points = 0.5)