knitr::opts_chunk$set(echo = TRUE, eval=F) library(drake) library(econDV) library(dplyr)
library(drake) library(rmd2drake) library(dplyr) library(googleclassroom) library(readr) library(rmdgrader) library(purrr) library(rlang) library(testthat) library(withr) rprojroot::is_rstudio_project$make_fix_file() -> .root .root <- function(){ "/Users/martinl/Github/course-dashboard-programming-for-data-science" } problemFolder <- file.path(.root(), params$submissionFolder, params$title, "problem")
# initiate process instance process <- Process() # get list of code chunks process$correctAnsFilename$tryGet_list_codeChunks() process$inBatch_studentsRmds$tryGet_list_codeChunks() # If one Rmd content changed, you can update simply that student's respective elements in process instance like: # process$studentsRmds$HW8_410672033.Rmd$tryGet_list_codeChunks()
After users get list_codeChunks from all Rmd files, it's time to evaluate these codes.
# Initiate an Evaluation Instance ei <- Evaluate(process) # resolve codes in batch ei$answerValues$batch$resolve$part4() ei$answerValues$batch$resolve$part5() # once resolved, answer values will show up for all Rmds such as: ei$answerValues$HW7_410672033.Rmd$values
process$file.edit$HW7_410874206.Rmd() process$studentsRmds$HW7_410874206.Rmd$move2problem()
Sometimes students throwed in, say totally wrong Rmd, it can break down batch evaluation. In this case, run the follow example code (which uses part4) as an example.
for(.it in seq_along(ei$allRmds)){ cat(glue::glue('{ei$allRmds[[.it]]}\n\n')) ei$answerValues[[ei$allRmds[[.it]]]]$resolve$part4() }
The loop stops at where the problem from, say HW7_410874206.Rmd. Then you can use the move2problem method to remove it. Just remember to do .nullify after each removal.
process$studentsRmds$HW7_410874206.Rmd$move2problem() process$.nullify()
process is actually equip with file.edit method. Use it like:
process$file.edit$HW7_410672056.Rmd()
Once done, you can restart a new Evaluation instance (no need to start from Process stage).
# You can also evaluate each Rmd codes one-by-one via their own resolve method. Once resolved, you can see the values after resolution ei$answerValues$`homework7-ans.Rmd`$resolve$part4() ei$answerValues$`homework7-ans.Rmd`$resolve$part5() ei$answerValues$`homework7-ans.Rmd`$resolve$part6() View(ei$answerValues$`homework7-ans.Rmd`$values)
You only save neccessary answer values for grading step via save method.
ei$save(filename = "data4step3.Rdata")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.