Search code examples
rr-exams

Generating an answer excel from all generated exams in R/exams


I'm a professor from the University College in Ghent (Belgium) and we are brainstorming about the organization of our exams, Research Techniques (quite a bit of statistics). We are thinking of generating individual exams for all our students, but we want to make the grading as easy as possible.

We were thinking of generating n exams, using R-exams and allowing the students to answer using google forms / OneDrive forms or whatever platform to generate an excel with al the answers from the students. The content of each answer vector would be different, although the type of answer for each question would be the same.

If would be awesome if we could generate an answer excel sheet with all the answers per generated exam: this way we only need to div the answer provided by the students with the answers generated by R-exams. Is such a functionality available or possible?

With kind regards

Jens Buysse


Solution

  • The functionality you are looking for is not readily available in R/exams but it is not too hard to write a little bit of code that puts it together.

    All exams2xyz() interfaces return a list of exams, containing a list of exercises, containing (among other things) the meta-information for each question. You can extract this and put it into an Excel sheet.

    Also you can use the exams_metainfo() extractor to display the information within R.

    As a simple example consider:

    library("exams")
    set.seed(0)
    exm <- exams2html(c("swisscapital.Rmd", "deriv.Rmd"), n = 3)
    

    Now exm is a list of n = 3 exams, each containing 2 exercises, for which then the metainformation can be extracted. For example for the first exercise in the first exam:

    exm[[1]][[1]]$metainfo$name
    ## [1] "Swiss Capital"
    exm[[1]][[1]]$metainfo$solution
    ## [1] FALSE FALSE FALSE TRUE FALSE
    exm[[1]][[1]]$metainfo$string
    ## [1] "Swiss Capital: 4"
    

    To display this information in R:

    exams_metainfo(exm)
    ## exam1
    ## 1. Swiss Capital: 4
    ## 2. derivative exp: 55.25 (55.24--55.26)
    ## 
    ## exam2
    ## 1. Swiss Capital: 2
    ## 2. derivative exp: 1.79 (1.78--1.8)
    ## 
    ## exam3
    ## 1. Swiss Capital: 4
    ## 2. derivative exp: 46.73 (46.72--46.74)
    

    You can also get just one exam via the print() method:

    print(exams_metainfo(exm), 2)
    ## exam2
    ## 1. Swiss Capital: 2
    ## 2. derivative exp: 1.79 (1.78--1.8)