%\VignetteEngine{knitr::knitr} \documentclass[a4]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{uebung} \IfFileExists{../../info.sty}{\usepackage{../../info}} {\IfFileExists{../info.sty}{\usepackage{../info}}{\usepackage{uebung-info}}} \usepackage{multicol} \usepackage{longtable} \usepackage{color} \usepackage{subfig} \title{Results Exam XYZ \\ Winter 202x} \author{Dr.\ Not Me} \date{\today} <>= ############################################### ## Start of user settings (modify only here) ## ############################################### ## set relative path to folder containing all input files, ## set to "" if files are in the same folder as this Rnw-file rel_path <- "" MC_answerfile_input <- "BAUG-answers-modified.csv" MC_keyfile_input <- "BAUG-key.csv" edoz_file_input <- "BAUG-edoz.txt" semester_PA_input <- NULL ## "BAUG-semester-PA.csv" ## Prefix in column names from AMC (usually "TICKED:") ## will be converted to internal prefix with make.names later on MC_prefix_prelim <- "TICKED:" ## In what format are the answers stored in MC_keyfile? ## "AB" or "TF" (True / False) MC_keyfile_type <- "TF" ## "AB" ## number_replace_source <- NULL ##"99-999-001" ## for testing purposes number_replace_dest <- NULL ##"18-935-908" ## Correction scheme for grading MC type_ <- "SC" ##"kprim" ##"SC" ## type_ of correction "SC" or "kprim" correct_ <- 1 ## point for correct answer (ignored for kprim) wrong_ <- 0 ## point for wrong answer (ignored for kprim) ## Grading function gradeFunction_name <- "gradesPiecewiseLinear" ##"gradesLinear" ## ## Grading settings gradeFunction_settings <- list( pointsFor4 = 54, ## Points necessary for grade 4 pointsFor6 = 76 ## Points necessary for grade 6 ) ## Settings for results.pdf (these affect only the appearance of the output) subtask_label <- "character" ##"numeric" ## ## Define min and max achievable points (relevant for visualization of ## grading scale etc.) min_points <- 0 ## TODO: change to vector? Cross-check with MC.key max_points <- 80 ## TODO: change to vector? Cross-check with MC.key step_size <- 1 ## step size (for presentation of grading scale only) ## Name of RData file to save results to (if NULL, results are not ## saved): rdata_file <- "examResults.RData" ## Expert settings: MC_answerfile_sep <- ";" MC_keyfile_sep <- "," ########################## ## End of user settings ## ########################## @ %% Sweave document showing exam outcomes %% THE SOURCE OF THIS DOCUMENT IS *.Rnw %% DO NOT EDIT THE *.tex FILE !!! <>= # set knitr option library(knitr) opts_chunk$set(concordance=TRUE) opts_chunk$set(engine = 'R', dev = 'pdf', fig.width = 6, fig.height = 3, strip.white = TRUE, tidy = FALSE, echo = FALSE, error = FALSE, results = 'hide', message = FALSE) options(knitr.duplicate.label = "allow") # load sfsGrading package and check version package_installed <- require(sfsGrading) # if not installed, prompt user to install the package # sfs path: /sfs/w/ftp/Teaching/sfs-grading-package if(!package_installed){ stop(paste("Please install the package 'sfsGrading'", "using the following command:", "install.packages('https://stat.ethz.ch/Teaching/sfs-grading-package/sfsGrading_current.tar.gz', repos = NULL, type = 'source')" )) } # get version number of installed package installed_version <- packageVersion("sfsGrading") # check whether this corresponds to the latest one # sfs path: /sfs/w/ftp/Teaching/sfs-grading-package connection <- url("https://stat.ethz.ch/Teaching/sfs-grading-package/current-version.txt") latest_version <- readLines(connection) close(connection) # if not, prompt user to install the latest version of the package if(installed_version < latest_version){ stop(paste("Your version of 'sfsGrading' is: ", installed_version, ". The latest version is: ", latest_version, ". Please run the following command to update the package to the latest version: ", "install.packages('https://stat.ethz.ch/Teaching/sfs-grading-package/sfsGrading_current.tar.gz', repos = NULL, type = 'source')", sep="")) } ## check version of results_MC.Rnw results_MC_version <- "05May2023" # check whether this corresponds to the latest one # sfs path: /sfs/w/ftp/Teaching/sfs-grading-package connectionRes <- url("https://stat.ethz.ch/Teaching/sfs-grading-package/results_MC-version.txt") latest_results_MC_version <- readLines(connectionRes) close(connectionRes) # if not, prompt user to install the latest version of results_MC.Rnw ignore.check <- FALSE ## set to TRUE to enable old version (do you know what you do?) if(!ignore.check & (results_MC_version != latest_results_MC_version)){ stop(paste("Your version of 'results_MC.Rnw' is: ", results_MC_version, ". The latest version is: ", latest_results_MC_version, ". Please update to the latest version from /sfs/w/ftp/Teaching/sfs-grading-package", sep="")) } @ <>= ## generate absolute filenames ## Prepare folder name input_folder <- file.path(knitr:::input_dir(), rel_path) ## Student answers (from scanning software) MC_answerfile <- file.path(input_folder, MC_answerfile_input) ## Solution MC_keyfile <- file.path(input_folder, MC_keyfile_input) ## Load edoz file edoz_file <- file.path(input_folder, edoz_file_input) ## Load semester performance file semester_PA_file <- if(exists("semester_PA_input") && !is.null(semester_PA_input)){ file.path(input_folder, semester_PA_input) }else{ NULL } @ <>= process_corrections_MC( MC.prefix.prelim = MC_prefix_prelim, edozFile = edoz_file, semesterPAfile = semester_PA_file, number.replace.source = number_replace_source, number.replace.dest = number_replace_dest, MC.answerfile = MC_answerfile, MC.answerfile.sep = MC_answerfile_sep, MC.keyfile = MC_keyfile, MC.keyfile.type = MC_keyfile_type, MC.keyfile.sep = MC_keyfile_sep, correct = correct_, wrong = wrong_, type = type_, gradeFunction.name = gradeFunction_name, gradeFunction.settings = gradeFunction_settings, rdataFile = rdata_file, subtask.label = subtask_label, minPoints = min_points, maxPoints = max_points, stepsize = step_size) @ \begin{document} \input{childs/output-file-MC} \end{document}